summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Ayers <andya@microsoft.com>2017-02-13 14:52:47 -0800
committerGitHub <noreply@github.com>2017-02-13 14:52:47 -0800
commit965d079c06a6945bfb022d3032ea7c3e2493ae68 (patch)
treea5c3e69b97abeec66f3548b979f7f6edc23c4f40
parent63af0e030f9c2de244dbc997822169a1f3dc8c92 (diff)
parenta26e2c670fc7a793794f4a499212a115c5d5a4b3 (diff)
downloadcoreclr-965d079c06a6945bfb022d3032ea7c3e2493ae68.tar.gz
coreclr-965d079c06a6945bfb022d3032ea7c3e2493ae68.tar.bz2
coreclr-965d079c06a6945bfb022d3032ea7c3e2493ae68.zip
Merge pull request #9562 from AndyAyersMS/FixMagicTypeEquality
Jit: fix for broken type equality optimization
-rw-r--r--src/jit/importer.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/jit/importer.cpp b/src/jit/importer.cpp
index 7a489332f5..1849a57848 100644
--- a/src/jit/importer.cpp
+++ b/src/jit/importer.cpp
@@ -7692,10 +7692,33 @@ DONE_CALL:
call = gtNewLclvNode(calliSlot, type);
}
}
+
// For non-candidates we must also spill, since we
// might have locals live on the eval stack that this
// call can modify.
- impSpillSideEffects(true, CHECK_SPILL_ALL DEBUGARG("non-inline candidate call"));
+ //
+ // Suppress this for certain well-known call targets
+ // that we know won't modify locals, eg calls that are
+ // recognized in gtCanOptimizeTypeEquality. Otherwise
+ // we may break key fragile pattern matches later on.
+ bool spillStack = true;
+ if (call->IsCall())
+ {
+ GenTreeCall* callNode = call->AsCall();
+ if ((callNode->gtCallType == CT_HELPER) && gtIsTypeHandleToRuntimeTypeHelper(callNode))
+ {
+ spillStack = false;
+ }
+ else if ((callNode->gtCallMoreFlags & GTF_CALL_M_SPECIAL_INTRINSIC) != 0)
+ {
+ spillStack = false;
+ }
+ }
+
+ if (spillStack)
+ {
+ impSpillSideEffects(true, CHECK_SPILL_ALL DEBUGARG("non-inline candidate call"));
+ }
}
}
@@ -12813,7 +12836,7 @@ void Compiler::impImportBlockCode(BasicBlock* block)
impHandleAccessAllowed(callInfo.accessAllowed, &callInfo.callsiteCalloutHelper);
#if 0 // DevDiv 410397 - This breaks too many obfuscated apps to do this in an in-place release
-
+
// DevDiv 291703 - we need to check for accessibility between the caller of InitializeArray
// and the field it is reading, thus it is now unverifiable to not immediately precede with
// ldtoken <filed token>, and we now check accessibility