https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80297
--- Comment #7 from rguenther at suse dot de <rguenther at suse dot de> --- On Tue, 4 Apr 2017, jakub at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80297 > > --- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- > (In reply to Richard Biener from comment #5) > > We can experiment with adding unshare_exprs to genmatch and see in how many > > patterns that triggers. But as said, the general issue looks latent to me. > > Folding during gimplification is dangerous. > > It isn't just folding during gimplification, we have hundreds of fold_build* > calls in tons of GIMPLE passes too, and at that point unsharing is also > needed. Well, any GENERIC created there needs to go through force_gimple_operand again. Hmm, but that doesn't unshare either. > I'll try to implement the unsharing and we can see how many patterns it > affects > and based on that decide if we want some cfun flag to control the unsharing or > not, ok? Ok. But given the above we have no choice.. What are the exact rules for GENERIC? ISTR it was that sub-expression sharing is allowed, right? Or is that just for frontend GENERIC? OTOH it would mean that fold-const.c has to cope with tree sharing but may not generate "new" sharing? That would be quite a difficult thing to verify with a verifier...