https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87047
--- Comment #4 from Alexander Monakov <amonakov at gcc dot gnu.org> --- This is probably due to logic issue in PR 78120 fix. Its Changelog said, (noce_process_if_block): Compute an estimate for the original cost when optimizing for speed, using the minimum of then and else block costs. but the change was + if (else_bb == NULL) + if_info->original_cost += then_cost; + else if (speed_p) + if_info->original_cost += MIN (then_cost, else_cost); + else + if_info->original_cost += then_cost + else_cost; so when there's no else_bb, it effectively treats its cost as infinite rather than zero. As a result GCC wrongly decides that replacing conditionally executed block with cost 80 by a sequence with cost 72 is fine. It also seems strange that costs are not scaled by edge probabilities.