https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118505
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pinskia at gcc dot gnu.org Target| |aarch64 Keywords| |missed-optimization Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Component|rtl-optimization |tree-optimization Last reconfirmed| |2025-01-16 Target Milestone|--- |15.0 --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- So the question is doing: if (a) { b = c * c; ... } else { ... (repeated the same as the ... above) } is faster than say: t = c * c; b = a ? t : a; And is it dependent on the type. In this case it is a floating point type. Does changing real_t to say int change the performance way way or another? if so we should also check the type of lhs. One other thing we could do here is add a target hook to get a decent cost model here and pass the type and tree code down. Note poor_ifcvt_candidate_code most likely should include RDIV_EXPR (but that is not the issue here).