https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85560
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization Status|UNCONFIRMED |NEW Last reconfirmed| |2018-04-30 Component|rtl-optimization |middle-end Summary|Missed optimization in |Missed optimization in |bit-by-bit variable zeroing |niter analysis for | |bit-by-bit variable zeroing Ever confirmed|0 |1 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- Confirmed. GCC fails to prove the loop is finite. This is a niter / SCEV analysis issue. It's a bit convoluted case so I'm not sure how we can handle this easily. GIMPLE: <bb 3> [local count: 955630224]: # a_10 = PHI <a_5(2), a_6(3)> # bits_11 = PHI <1(2), bits_7(3)> _1 = ~bits_11; a_6 = _1 & a_10; bits_7 = bits_11 << 1; if (a_6 == 0) goto <bb 4>; [11.00%] else goto <bb 3>; [89.00%] we do have the force-simulation code which in theory could also be used to compute an upper bound rather than an exact niter count. But then for this case it needs to maintain fuzzy lattices (for bits).