https://gcc.gnu.org/g:ca6e6d317ca245682e8f06e3bb7cd6a76ffd0357

commit r16-6070-gca6e6d317ca245682e8f06e3bb7cd6a76ffd0357
Author: Andrew Pinski <[email protected]>
Date:   Tue Dec 9 01:09:53 2025 -0800

    ldist: Fix probability on loop exit
    
    While moving the phi part of removal of forwarder blocks,
    I noticed that I was getting some failures due to "mismatch counts".
    I worked around the issue by disabling the case where the forwarder
    block would just get merged. I have now gone back and found
    the problem is in ldist where it is removing the loop
    by changing the exit to always exit but forgot to update
    the edge to always probability. This fixes that and
    also removes a few of the "mismatch counts".
    
    Bootstrapped and tested on x86_64-linux-gnu.
    
    gcc/ChangeLog:
    
            PR tree-optimization/103680
            * tree-loop-distribution.cc (destroy_loop): Set probability
            of the exit edge to be always.
    
    Signed-off-by: Andrew Pinski <[email protected]>

Diff:
---
 gcc/tree-loop-distribution.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/tree-loop-distribution.cc b/gcc/tree-loop-distribution.cc
index fc0cd3952d56..73e5cab98292 100644
--- a/gcc/tree-loop-distribution.cc
+++ b/gcc/tree-loop-distribution.cc
@@ -1353,6 +1353,7 @@ destroy_loop (class loop *loop)
   redirect_edge_pred (exit, src);
   exit->flags &= ~(EDGE_TRUE_VALUE|EDGE_FALSE_VALUE);
   exit->flags |= EDGE_FALLTHRU;
+  exit->probability = profile_probability::always ();
   cancel_loop_tree (loop);
   rescan_loop_exit (exit, false, true);

Reply via email to