https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97225
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2020-09-28 Component|c |tree-optimization Keywords| |missed-optimization Ever confirmed|0 |1 Status|UNCONFIRMED |NEW --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- I think we've seen a duplicate report for this. Confirmed. late phiopt sees (we need hoisting to get rid of the loads in the two if arms): <bb 2> [local count: 1073741824]: _1 = vec_6(D)->size; pretmp_9 = vec_6(D)->data; if (_1 == 0) goto <bb 4>; [34.00%] else goto <bb 3>; [66.00%] <bb 3> [local count: 708669601]: _3 = _1 * 4; _7 = pretmp_9 + _3; <bb 4> [local count: 1073741824]: # _4 = PHI <_7(3), pretmp_9(2)> return _4; where it misses the value-conversion, possibly either based on lack of handling the mult+add or because of consideration of making the not infrequent path more expensive. Later if-converting this anyway on RTL shows a disconnect in cost then.