https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65217
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization, xfail Status|RESOLVED |REOPENED Last reconfirmed| |2015-04-27 CC| |law at gcc dot gnu.org, | |rguenth at gcc dot gnu.org Component|c |tree-optimization Resolution|FIXED |--- Ever confirmed|0 |1 --- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- It was only fixed by luck due to us folding all stmts in forwprop which turns if (_3 != n_1(D)) into the canonical if (n_1(D) != _3) and then DOM recording the "proper" equality via record_equality by _always_ swapping operands due to else if (is_gimple_min_invariant (x) /* ??? When threading over backedges the following is important for correctness. See PR61757. */ || (loop_depth_of_name (x) <= loop_depth_of_name (y))) and its '==' part. For non-canonical order (in GCC 4.9 and earlier) that swapping turned it into the unfortunate direction. That equality decides whether we propagate _3 into the return value on the else branch (where n_1(D) == _3) or leave it as n_1(D) (good for this case). I am about to commit a patch that does not perform this kind of random swapping (and will XFAIL the testcase).