summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarol Eidt <carol.eidt@microsoft.com>2019-06-19 16:21:03 -0700
committerGitHub <noreply@github.com>2019-06-19 16:21:03 -0700
commit6d0672acfba8dd2342dd528a5cd27c677b6981a2 (patch)
tree06b92650a1360f6a1b9f13bc5a4f4a5310dac889
parent23918ce912fc051b4a2443977e6973e34988c4f4 (diff)
downloadcoreclr-6d0672acfba8dd2342dd528a5cd27c677b6981a2.tar.gz
coreclr-6d0672acfba8dd2342dd528a5cd27c677b6981a2.tar.bz2
coreclr-6d0672acfba8dd2342dd528a5cd27c677b6981a2.zip
Restrict copyprop if address-taken (#25247)
* Restrict copyprop if address-taken Fix #25231
-rw-r--r--src/jit/copyprop.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/jit/copyprop.cpp b/src/jit/copyprop.cpp
index 29aa92e0d7..5c225337e4 100644
--- a/src/jit/copyprop.cpp
+++ b/src/jit/copyprop.cpp
@@ -180,6 +180,17 @@ void Compiler::optCopyProp(BasicBlock* block, GenTreeStmt* stmt, GenTree* tree,
continue;
}
+ // Do not copy propagate if the old and new lclVar have different 'doNotEnregister' settings.
+ // This is primarily to avoid copy propagating to IND(ADDR(LCL_VAR)) where the replacement lclVar
+ // is not marked 'lvDoNotEnregister'.
+ // However, in addition, it may not be profitable to propagate a 'doNotEnregister' lclVar to an
+ // existing use of an enregisterable lclVar.
+
+ if (lvaTable[lclNum].lvDoNotEnregister != lvaTable[newLclNum].lvDoNotEnregister)
+ {
+ continue;
+ }
+
if (op->gtFlags & GTF_VAR_CAST)
{
continue;