[PATCH] Fix devirtualization ICE (PR tree-optimization/59622, take 3)

Richard Biener rguenther@suse.de
Wed Jan 8 11:11:00 GMT 2014


On Wed, 8 Jan 2014, Jakub Jelinek wrote:

> On Wed, Jan 08, 2014 at 11:45:28AM +0100, Richard Biener wrote:
> > I prefer to always do this, not do the fancy insertion-before.  That
> > would do repeated folding for
> > 
> >    fold_stmt (gsi);
> >    fold_stmt (gsi);
> >    fold_stmt (gsi);
> > 
> > where the last two should be a no-op.
> 
> I don't see how is that possible, at least for the __builtin_unreachable
> case, because by just setting the fndecl to __builtin_unreachable and
> keeping the incompatible fntype and bogus arguments for it all the
> predicates whether it is a valid/suitable builtin call will fail and we
> don't have a __builtin_unreachable function you could call.

Well, that just means we need two sets of predicates to check for
a builtin call.  The __builtin_unreachable code wants to know what
the callee is, not if that's a "valid" call to it.  But yeah - this
starts to get confusing :/

> So at least for builtin we want to make sure it has the right parameters.
> If the lhs is something we can just initialize to zero, we can replace the
> call with zeroing the lhs, but that is no the case always.

I start to think this is a too complex transform for stmt folding ...

> For __cxa_pure_virtual we could just keep the code as is (just with the
> !inplace addition and spelling fix?), but would need to fix up whatever ICEs
> during checking on it to honor fntype rather than decl's type.

Yes.

So a patch just keeping the targets.length () == 1 case in folding
with just replacing the fndecl of the call is ok.

Thanks,
Richard.



More information about the Gcc-patches mailing list