From ca6e6d317ca245682e8f06e3bb7cd6a76ffd0357 Mon Sep 17 00:00:00 2001 From: Andrew Pinski Date: Tue, 9 Dec 2025 01:09:53 -0800 Subject: [PATCH] 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 --- 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 fc0cd3952d5..73e5cab9829 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); -- 2.47.3