https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112418
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Created attachment 59076 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59076&action=edit Start of the patch This is the start but the patch does too much for little benifit. Example: ``` int g(int); int h(int); int f(int a, int b, int d) { int c; if (a < 0) { d = b; c = d > 0 ? d : -d; g(-a); } else { c = d > 0 ? d : -d; h(a); } return h(c) + h(c) * g(c) * c; } ``` I have to add some small costing like what was done for the integer cst with convert case (see PR71016 ). Oh and that also needs to be improved in some cases too but that is a different story.