https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122675
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jeff Law <[email protected]>: https://gcc.gnu.org/g:528df313f6d941cde12c12bdeb20d6d24e05ba4b commit r16-5931-g528df313f6d941cde12c12bdeb20d6d24e05ba4b Author: Dimitar Dimitrov <[email protected]> Date: Fri Dec 5 21:57:58 2025 -0700 [PATCH v3] rtl-optimization: Fix BB edge ordering [PR122675] Starting with r16-4438-ga93f80feeef744, the edge sorting order was switched to lowest execution frequency first. But the "bbro" optimization pass chooses the first edge as a fallthrough. Thus the most unlikely branches were optimized to fallthroughs. Fix by restoring the sorting order prior to r16-4438-ga93f80feeef744. Now the branches most likely to be executed are picked as fallthroughs. There are no regressions for C and C++ on x86_64-pc-linux-gnu. The new tests fail for the respective targets without this patch, and pass with it. PR rtl-optimization/122675 gcc/ChangeLog: * bb-reorder.cc (edge_order): Fix BB edge ordering to be descending. gcc/testsuite/ChangeLog: * gcc.target/aarch64/pr122675-1.c: New test. * gcc.target/i386/pr122675-1.c: New test. * gcc.target/riscv/pr122675-1.c: New test. Signed-off-by: Dimitar Dimitrov <[email protected]>
