https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94589
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2020-04-14 Ever confirmed|0 |1 CC| |rguenth at gcc dot gnu.org --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- Hmm. I would have said phiopt but then there's the missing opportunity to handle PHIs as COND_EXPRs and simplify them via match.pd patterns. In this case simplify i_1(D) != 0 ? i_1(D) >= 0 : 0 that could be forwprops job then. The only pecularity is when the PHI isn't the only thing controlled by the condition, thus the control flow not vanishing with replacing the PHI. In this case we'd turn the code into <bb 2> [local count: 1073741824]: if (i_1(D) != 0) goto <bb 3>; [50.00%] else goto <bb 4>; [50.00%] <bb 3> [local count: 536870913]: _2 = i_1(D) >= 0; <bb 4> [local count: 1073741824]: prephitmp_6 = i_1(D) > 0; return prephitmp_6; and leave the rest to DCE. Obviously if the other two compares are not dead afterwards this isn't going to be a good idea. And CFG pattern matching is done by phiopt - which for the actual simplification could resort to match.pd simplifying a COND_EXPR as well. And yeah, I think there's a dup about PHIs and "folding".