This adjusts simple_control_dep_chain in the same way I adjusted
compute_control_dep_chain_pdom to avoid adding fallthru edges to
the predicate chain.

Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.

        PR tree-optimization/106881
        * gimple-predicate-analysis.cc (simple_control_dep_chain):
        Add only non-fallthru edges and avoid the same set of edges
        as compute_control_dep_chain_pdom does.
---
 gcc/gimple-predicate-analysis.cc | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/gcc/gimple-predicate-analysis.cc b/gcc/gimple-predicate-analysis.cc
index 910ab97a29e..bc9ed847267 100644
--- a/gcc/gimple-predicate-analysis.cc
+++ b/gcc/gimple-predicate-analysis.cc
@@ -926,10 +926,14 @@ simple_control_dep_chain (vec<edge>& chain, basic_block 
from, basic_block to)
     {
       basic_block dest = src;
       src = get_immediate_dominator (CDI_DOMINATORS, src);
-      edge pred_e;
-      if (single_pred_p (dest)
-         && (pred_e = find_edge (src, dest)))
-       chain.safe_push (pred_e);
+      if (single_pred_p (dest))
+       {
+         edge pred_e = single_pred_edge (dest);
+         gcc_assert (pred_e->src == src);
+         if (!(pred_e->flags & ((EDGE_FAKE | EDGE_ABNORMAL | EDGE_DFS_BACK)))
+             && !single_succ_p (src))
+           chain.safe_push (pred_e);
+       }
     }
 }
 
-- 
2.35.3

Reply via email to