From 2f90cb8b36affbb28dba643dd38068fc88c76e12 Mon Sep 17 00:00:00 2001
From: Andrew MacLeod <amacleod@redhat.com>
Date: Fri, 14 Jun 2024 11:01:08 -0400
Subject: [PATCH 3/7] Dont add varying values to gori_on_edge mass
calculations.
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 | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
@@ -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);
+ }
}
}
--
2.45.0