This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Tree tail merging breaks __builtin_unreachable optimization
- From: Andrew Pinski <pinskia at gmail dot com>
- To: Ulrich Weigand <uweigand at de dot ibm dot com>
- Cc: gcc-patches at gcc dot gnu dot org, tom at codesourcery dot com
- Date: Wed, 4 Jul 2012 11:09:05 -0700
- Subject: Re: Tree tail merging breaks __builtin_unreachable optimization
- References: <201207041702.q64H2GGj017517@d06av02.portsmouth.uk.ibm.com>
On Wed, Jul 4, 2012 at 10:02 AM, Ulrich Weigand <uweigand@de.ibm.com> wrote:
> Any suggestions how to fix this? ÂShould tail merging detect
> __builtin_unreachable and not merge such block? ÂOr else, should
> the CFG optimizer be extended (how?) to handle unreachable blocks
> with multiple predecessors better?
This bug has nothing to do with tail merging except tail merging
exposing it. I have seen this behavior on MIPS even without tail
merging. The problem is how __builtin_unreachable is implemented. It
is implemented fine on the tree level but once it is expanded to RTL,
to optimize it away it depends on the unreachable basic block being
right after the conditional.
See PR 50385 #c1 which shows exactly the problem I saw while
implementing a basic block reorder on the tree level.
Thanks,
Andrew Pinski