summaryrefslogtreecommitdiff
path: root/src/jit/morph.cpp
diff options
context:
space:
mode:
authorAndy Ayers <andya@microsoft.com>2019-02-26 11:39:46 -0800
committerGitHub <noreply@github.com>2019-02-26 11:39:46 -0800
commit56697257c4e24aa24a64b70eb4ce07d91882005b (patch)
treef7c8b6d78f41a9ba1a5d2d854eedb3f1fede67de /src/jit/morph.cpp
parentd05683140358e69109d126770f8076bfe5090092 (diff)
downloadcoreclr-56697257c4e24aa24a64b70eb4ce07d91882005b.tar.gz
coreclr-56697257c4e24aa24a64b70eb4ce07d91882005b.tar.bz2
coreclr-56697257c4e24aa24a64b70eb4ce07d91882005b.zip
JIT: In morph, only call DefinesLocal on assignments (#22753)
When checking for local assertions to kill in morph, only call `DefinesLocal` on `GT_ASG` nodes. Also, assert that we never see LIR style assignments. Resolves #22747.
Diffstat (limited to 'src/jit/morph.cpp')
-rw-r--r--src/jit/morph.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/jit/morph.cpp b/src/jit/morph.cpp
index ff9320ab26..f3556ad001 100644
--- a/src/jit/morph.cpp
+++ b/src/jit/morph.cpp
@@ -15184,7 +15184,16 @@ void Compiler::fgMorphTreeDone(GenTree* tree,
{
/* Is this an assignment to a local variable */
GenTreeLclVarCommon* lclVarTree = nullptr;
- if (tree->DefinesLocal(this, &lclVarTree))
+
+ // The check below will miss LIR-style assignments.
+ //
+ // But we shouldn't be running local assertion prop on these,
+ // as local prop gets disabled when we run global prop.
+ assert(!tree->OperIs(GT_STORE_LCL_VAR, GT_STORE_LCL_FLD));
+
+ // DefinesLocal can return true for some BLK op uses, so
+ // check what gets assigned only when we're at an assignment.
+ if (tree->OperIs(GT_ASG) && tree->DefinesLocal(this, &lclVarTree))
{
unsigned lclNum = lclVarTree->gtLclNum;
noway_assert(lclNum < lvaCount);