This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Fix -fcompare-debug issue in tree profiler (PR debug/46255)
On Tue, Nov 2, 2010 at 12:07 AM, Jakub Jelinek <firstname.lastname@example.org> wrote:
> On Mon, Nov 01, 2010 at 11:29:57PM +0100, Richard Guenther wrote:
>> On Mon, Nov 1, 2010 at 8:21 PM, Jakub Jelinek <email@example.com> wrote:
>> > While debug stmts are never considered to need fake edges, it currently
>> > (incorrectly) makes a difference whether a stmt that needs fake edges
>> > was the last one or not. ?Fixed by disregarding any debug stmts
>> > at the end of bb.
>> > Bootstrapped/regtested on x86_64-linux and i686-linux. ?Ok for trunk?
>> Hmm, you mean that the stmt needing fake edges doesn't end the BB?
>> So your patch fixes that by splitting the BB at the appropriate point?
> No, that was what the code was doing before and that caused the
> -fcompare-debug differences, because without -g the bb was not split, with
> -g it was split.
Hmm, I remember we drop DEBUG statements after calls that throw
to be able to split the BB at the appropriate point. Do we?
> profile.c uses block_ends_with_call_p, which for gimple uses
> /* Return true if BB ends with a call, possibly followed by some
> ? instructions that must stay with the call. ?Return false,
> ? otherwise. ?*/
> static bool
> gimple_block_ends_with_call_p (basic_block bb)
> ?gimple_stmt_iterator gsi = gsi_last_nondebug_bb (bb);
> ?return !gsi_end_p (gsi) && is_gimple_call (gsi_stmt (gsi));
> Having the fake edge gong not immediately from the call, but
> from the end of bb where the call is followed only by debug stmts,
> seems to work just fine, all it means is the profiling stuff
> gets emitted before or after those debug stmts which really result in
> no code being generated.
I guess as they are fake edges and only profiling uses it (but it's
a CFG hook also implemented on RTL ... huh...) it probably doesn't matter.
So, the patch is ok. It would be nice to make this localized though
and remove the hookization of this functionality.
> ? ? ? ?Jakub