https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77498
Thomas Preud'homme <thopre01 at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |thopre01 at gcc dot gnu.org --- Comment #8 from Thomas Preud'homme <thopre01 at gcc dot gnu.org> --- (In reply to Richard Biener from comment #7) > Ok, so given we can't have PRE do as good as predcom and a "cost model" for > PRE is out of the question for GCC 7 the following dumbs down PRE again. It > does so in the very much simplest way rather than trying to block this only > during elimination / insertion. This should be definitely revisited for GCC > 8. > > Index: gcc/tree-ssa-pre.c > =================================================================== > --- gcc/tree-ssa-pre.c (revision 246026) > +++ gcc/tree-ssa-pre.c (working copy) > @@ -1468,10 +1468,20 @@ phi_translate_1 (pre_expr expr, bitmap_s > leader for it. */ > if (constant->kind != CONSTANT) > { > - unsigned value_id = get_expr_value_id (constant); > - constant = find_leader_in_sets (value_id, set1, set2); > - if (constant) > - return constant; > + /* Do not allow simplifications to non-constants over > + backedges as this will likely result in a loop PHI > node > + to be inserted and increased register pressure. > + See PR77498 - this avoids doing predcoms work in > + a less efficient way. */ > + if (find_edge (pred, phiblock)->flags & EDGE_DFS_BACK) > + ; > + else > + { > + unsigned value_id = get_expr_value_id (constant); > + constant = find_leader_in_sets (value_id, set1, > set2); > + if (constant) > + return constant; > + } > } > else > return constant; I don't know for Yuri's issue but at least it sadly does not help with the problem reported by Andre for arm-none-eabi [1]. I'll try to come up with a testcase next week. [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77498#c2