From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4530 invoked by alias); 19 Jan 2013 21:48:31 -0000 Received: (qmail 4486 invoked by uid 55); 19 Jan 2013 21:48:14 -0000 From: "hubicka at ucw dot cz" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/42371] dead code not eliminated during folding with whole-program Date: Sat, 19 Jan 2013 21:48:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: hubicka at ucw dot cz X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: mjambor at suse dot cz X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2013-01/txt/msg01849.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42371 --- Comment #15 from Jan Hubicka 2013-01-19 21:48:12 UTC --- > Clearing of address-taken does not work: > > two/1 (two) @0x7fafc0e29818 > Type: function > Visibility: prevailing_def_ironly > Address is taken. > References: > Referring: main/3 (addr) > Availability: available > Function flags: analyzed body finalized > Called by: > Calls: > > that is, we do not re-compute address-taken after IPA inline transform stage > and thus do not reclaim indirectly inlined functions that we no longer need. We can't recompute here because inlining transform happens during the final compilation stage, so the functions are already beging output to the assembly. IPA-prop needs to realize that indirect inlining is going to optimize out the address operation and remove the reference. I assume this is not too hard to implement - we only need to record when the function parameter is used _only_ of the stuff represented by jump functions and indirect edges. I was trying to convince Martin to implement this for a while :) Virtual functions are ven harder than indirect calls since we need to figure out the vtable will become unreachable at the IPA stage. Honza