summaryrefslogtreecommitdiff
path: root/src/jit/valuenum.cpp
diff options
context:
space:
mode:
authorEugene Rozenfeld <erozen@microsoft.com>2019-02-12 14:43:14 -0800
committerGitHub <noreply@github.com>2019-02-12 14:43:14 -0800
commit1a962737c44b3a9c263e2ca25cbb647c70eeb01e (patch)
treeeda2c4fa69a3619f1d7ba2f504b04d8b1c3b62b5 /src/jit/valuenum.cpp
parentde2fe10e6f53dd4f05f04e9ddad0ccd7619829a0 (diff)
downloadcoreclr-1a962737c44b3a9c263e2ca25cbb647c70eeb01e.tar.gz
coreclr-1a962737c44b3a9c263e2ca25cbb647c70eeb01e.tar.bz2
coreclr-1a962737c44b3a9c263e2ca25cbb647c70eeb01e.zip
Fix exception sets for indirections in value numbering. (#22542)
fgValueNumberAddExceptionSetForIndirection had a bug where INDIR(ADD(x, <big_offset>)) had NullReferenceException(x) added instead of NullReferenceException(ADD(x, <big_offset>)). Fixes #20358.
Diffstat (limited to 'src/jit/valuenum.cpp')
-rw-r--r--src/jit/valuenum.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/jit/valuenum.cpp b/src/jit/valuenum.cpp
index adb7b7b8f3..dd4ce0524c 100644
--- a/src/jit/valuenum.cpp
+++ b/src/jit/valuenum.cpp
@@ -9239,15 +9239,6 @@ void Compiler::fgValueNumberAddExceptionSetForIndirection(GenTree* tree, GenTree
while (vnStore->GetVNFunc(baseLVN, &funcAttr) && (funcAttr.m_func == (VNFunc)GT_ADD) &&
(vnStore->TypeOfVN(baseLVN) == TYP_BYREF))
{
- if (fgIsBigOffset(offsetL))
- {
- // Failure: Exit this loop if we have a "big" offset
-
- // reset baseLVN back to the full address expression
- baseLVN = baseVNP.GetLiberal();
- break;
- }
-
// The arguments in value numbering functions are sorted in increasing order
// Thus either arg could be the constant.
if (vnStore->IsVNConstant(funcAttr.m_args[0]) && varTypeIsIntegral(vnStore->TypeOfVN(funcAttr.m_args[0])))
@@ -9264,20 +9255,20 @@ void Compiler::fgValueNumberAddExceptionSetForIndirection(GenTree* tree, GenTree
{
break;
}
- }
- while (vnStore->GetVNFunc(baseCVN, &funcAttr) && (funcAttr.m_func == (VNFunc)GT_ADD) &&
- (vnStore->TypeOfVN(baseCVN) == TYP_BYREF))
- {
- if (fgIsBigOffset(offsetC))
+ if (fgIsBigOffset(offsetL))
{
// Failure: Exit this loop if we have a "big" offset
- // reset baseCVN back to the full address expression
- baseCVN = baseVNP.GetConservative();
+ // reset baseLVN back to the full address expression
+ baseLVN = baseVNP.GetLiberal();
break;
}
+ }
+ while (vnStore->GetVNFunc(baseCVN, &funcAttr) && (funcAttr.m_func == (VNFunc)GT_ADD) &&
+ (vnStore->TypeOfVN(baseCVN) == TYP_BYREF))
+ {
// The arguments in value numbering functions are sorted in increasing order
// Thus either arg could be the constant.
if (vnStore->IsVNConstant(funcAttr.m_args[0]) && varTypeIsIntegral(vnStore->TypeOfVN(funcAttr.m_args[0])))
@@ -9294,6 +9285,15 @@ void Compiler::fgValueNumberAddExceptionSetForIndirection(GenTree* tree, GenTree
{
break;
}
+
+ if (fgIsBigOffset(offsetC))
+ {
+ // Failure: Exit this loop if we have a "big" offset
+
+ // reset baseCVN back to the full address expression
+ baseCVN = baseVNP.GetConservative();
+ break;
+ }
}
// Create baseVNP, from the values we just computed,