summaryrefslogtreecommitdiff
path: root/src/jit/rangecheck.cpp
diff options
context:
space:
mode:
authorBrian Sullivan <briansul@microsoft.com>2018-02-08 17:57:04 -0800
committerGitHub <noreply@github.com>2018-02-08 17:57:04 -0800
commit71aafbff34ba2d9b58dfc5e580dca7a0a6f7d92b (patch)
tree773088cf842d9de63cafe41f5305b4e44947ac35 /src/jit/rangecheck.cpp
parentb4fc69e24100a4f04bf5dc090a9e391217a3a088 (diff)
parente2d3db35bf35e095caccbb4a5ea2cd22a2a7a8a6 (diff)
downloadcoreclr-71aafbff34ba2d9b58dfc5e580dca7a0a6f7d92b.tar.gz
coreclr-71aafbff34ba2d9b58dfc5e580dca7a0a6f7d92b.tar.bz2
coreclr-71aafbff34ba2d9b58dfc5e580dca7a0a6f7d92b.zip
Merge pull request #15595 from mikedn/rc-binop
Remove useless RangeCheck::Limit::keArray
Diffstat (limited to 'src/jit/rangecheck.cpp')
-rw-r--r--src/jit/rangecheck.cpp31
1 files changed, 6 insertions, 25 deletions
diff --git a/src/jit/rangecheck.cpp b/src/jit/rangecheck.cpp
index c2826bd41c..15c01b3a46 100644
--- a/src/jit/rangecheck.cpp
+++ b/src/jit/rangecheck.cpp
@@ -129,12 +129,6 @@ bool RangeCheck::BetweenBounds(Range& range, int lower, GenTree* upper)
return false;
}
- // If lower limit is len return false.
- if (range.LowerLimit().IsArray())
- {
- return false;
- }
-
// Since upper limit is bounded by the array, return true if lower bound is good.
if (range.LowerLimit().IsConstant() && range.LowerLimit().GetConstant() >= 0)
{
@@ -601,9 +595,8 @@ void RangeCheck::MergeEdgeAssertions(GenTreeLclVarCommon* lcl, ASSERT_VALARG_TP
{
continue;
}
- limit.type = Limit::keArray;
- limit.vn = info.vnBound;
- cmpOper = (genTreeOps)info.cmpOper;
+ limit = Limit(Limit::keBinOpArray, info.vnBound, 0);
+ cmpOper = (genTreeOps)info.cmpOper;
}
// Current assertion is of the form (i < 100) != 0
else if (curAssertion->IsConstantBound())
@@ -631,7 +624,7 @@ void RangeCheck::MergeEdgeAssertions(GenTreeLclVarCommon* lcl, ASSERT_VALARG_TP
continue;
}
- assert(limit.IsBinOpArray() || limit.IsArray() || limit.IsConstant());
+ assert(limit.IsBinOpArray() || limit.IsConstant());
// Make sure the assertion is of the form != 0 or == 0.
if (curAssertion->op2.vn != m_pCompiler->vnStore->VNZeroForType(TYP_INT))
@@ -694,10 +687,9 @@ void RangeCheck::MergeEdgeAssertions(GenTreeLclVarCommon* lcl, ASSERT_VALARG_TP
}
// Check if the incoming limit from assertions tightens the existing upper limit.
- if ((pRange->uLimit.IsArray() || pRange->uLimit.IsBinOpArray()) && pRange->uLimit.vn == arrLenVN)
+ if (pRange->uLimit.IsBinOpArray() && (pRange->uLimit.vn == arrLenVN))
{
// We have checked the current range's (pRange's) upper limit is either of the form:
- // length
// length + cns
// and length == the bndsChkCandidate's arrLen
//
@@ -711,7 +703,7 @@ void RangeCheck::MergeEdgeAssertions(GenTreeLclVarCommon* lcl, ASSERT_VALARG_TP
continue;
}
- int curCns = (pRange->uLimit.IsBinOpArray()) ? pRange->uLimit.cns : 0;
+ int curCns = pRange->uLimit.cns;
int limCns = (limit.IsBinOpArray()) ? limit.cns : 0;
// Incoming limit doesn't tighten the existing upper limit.
@@ -723,7 +715,7 @@ void RangeCheck::MergeEdgeAssertions(GenTreeLclVarCommon* lcl, ASSERT_VALARG_TP
}
else
{
- // Current range's upper bound is not "length or length + cns" and the
+ // Current range's upper bound is not "length + cns" and the
// incoming limit is not on the same length as the bounds check candidate.
// So we could skip this assertion. But in cases, of Dependent or Unknown
// type of upper limit, the incoming assertion still tightens the upper
@@ -948,17 +940,6 @@ bool RangeCheck::GetLimitMax(Limit& limit, int* pMax)
}
break;
- case Limit::keArray:
- {
- int tmp = GetArrLength(limit.vn);
- if (tmp <= 0)
- {
- tmp = ARRLEN_MAX;
- }
- max1 = tmp;
- }
- break;
-
default:
return false;
}