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. 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. 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. Jakub