aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2020-04-27 14:17:13 +0200
committerAldy Hernandez <aldyh@redhat.com>2020-04-28 18:26:26 +0200
commit73d5e1ca792f8844dac4a5e834a41b1cebccecac (patch)
treec6b2942c8fe430d766259423dafa2daf33009787
parente8fd51064cbeed09a246dd95b3c6ad9099283155 (diff)
downloadgcc-73d5e1ca792f8844dac4a5e834a41b1cebccecac.zip
gcc-73d5e1ca792f8844dac4a5e834a41b1cebccecac.tar.gz
gcc-73d5e1ca792f8844dac4a5e834a41b1cebccecac.tar.bz2
Adjust bitwise and op1_range so it works with LHS of VARYING.
Nothing can be determined from: VARYING = OP1 & MASK In which case, return VARYING.
-rw-r--r--gcc/range-op.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/gcc/range-op.cc b/gcc/range-op.cc
index 2e19a3c..9d8bc6e 100644
--- a/gcc/range-op.cc
+++ b/gcc/range-op.cc
@@ -2150,6 +2150,16 @@ operator_bitwise_and::simple_op1_range_solver (irange &r, tree type,
const irange &lhs,
const irange &op2) const
{
+ // FIXME: This needs work. Ideally, start with VARYING and take out
+ // ranges we know are impossible.
+ //
+ // i.e. [MIN+1, MAX] = op1 & 255
+ // op1 is still varying.
+ if (lhs.varying_p ())
+ {
+ r.set_varying (type);
+ return;
+ }
if (!op2.singleton_p ())
{
// We bail on anything that's not a singleton mask, but at least
@@ -2235,7 +2245,11 @@ operator_bitwise_and::op1_range (irange &r, tree type,
return op_logical_and.op1_range (r, type, lhs, op2);
if (lhs.num_pairs () == 1)
- simple_op1_range_solver (r, type, lhs, op2);
+ {
+ simple_op1_range_solver (r, type, lhs, op2);
+ if (r.undefined_p ())
+ return false;
+ }
else
{
r.set_undefined ();