]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Dont add varying values to gori_on_edge mass calculations.
authorAndrew MacLeod <amacleod@redhat.com>
Fri, 14 Jun 2024 15:01:08 +0000 (11:01 -0400)
committerAndrew MacLeod <amacleod@redhat.com>
Fri, 14 Jun 2024 19:16:38 +0000 (15:16 -0400)
gori_on_edge will return an ssa_lazy_cache with all contextual ranges
that can be generated by an edge.   This patch adjusts it so that
a VARYING range is never added.

* gimple-range-gori.cc (gori_calc_operands): Do not continue nor
add the range when VARYING is produced for an operand.

gcc/gimple-range-gori.cc

index d489aef312ce848b0a7e53d9c80e9ab4f00c6ee4..4f6073c715af60c193ebc035dd8f22c36ba96705 100644 (file)
@@ -1605,11 +1605,14 @@ gori_calc_operands (vrange &lhs, gimple *stmt, ssa_cache &r, range_query *q)
       tmp.set_type (TREE_TYPE (si.ssa1));
       if (si.calc_op1 (tmp, lhs, si.op2_range))
        si.op1_range.intersect (tmp);
-      r.set_range (si.ssa1, si.op1_range);
-      gimple *src = SSA_NAME_DEF_STMT (si.ssa1);
-      // If defintion is in the same basic lock, evaluate it.
-      if (src && gimple_bb (src) == gimple_bb (stmt))
-       gori_calc_operands (si.op1_range, src, r, q);
+      if (!si.op1_range.varying_p ())
+       {
+         r.set_range (si.ssa1, si.op1_range);
+         gimple *src = SSA_NAME_DEF_STMT (si.ssa1);
+         // If defintion is in the same basic lock, evaluate it.
+         if (src && gimple_bb (src) == gimple_bb (stmt))
+           gori_calc_operands (si.op1_range, src, r, q);
+       }
     }
 
   if (si.ssa2 && !r.has_range (si.ssa2))
@@ -1617,10 +1620,13 @@ gori_calc_operands (vrange &lhs, gimple *stmt, ssa_cache &r, range_query *q)
       tmp.set_type (TREE_TYPE (si.ssa2));
       if (si.calc_op2 (tmp, lhs, si.op1_range))
        si.op2_range.intersect (tmp);
-      r.set_range (si.ssa2, si.op2_range);
-      gimple *src = SSA_NAME_DEF_STMT (si.ssa2);
-      if (src && gimple_bb (src) == gimple_bb (stmt))
-       gori_calc_operands (si.op2_range, src, r, q);
+      if (!si.op2_range.varying_p ())
+       {
+         r.set_range (si.ssa2, si.op2_range);
+         gimple *src = SSA_NAME_DEF_STMT (si.ssa2);
+         if (src && gimple_bb (src) == gimple_bb (stmt))
+           gori_calc_operands (si.op2_range, src, r, q);
+       }
     }
 }