diff options
author | Andy Ayers <andya@microsoft.com> | 2017-09-15 14:09:19 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-15 14:09:19 -0700 |
commit | a38aa2433942a2a200ca483c104fb0adf71db6e3 (patch) | |
tree | 3da251211245f02cff78adb248fff1ea8490fc57 | |
parent | 776b2bf39f3ef429d9e92633d3de4337f8b42bfc (diff) | |
download | coreclr-a38aa2433942a2a200ca483c104fb0adf71db6e3.tar.gz coreclr-a38aa2433942a2a200ca483c104fb0adf71db6e3.tar.bz2 coreclr-a38aa2433942a2a200ca483c104fb0adf71db6e3.zip |
JIT: Fix crossgen failure in gtTryRemoveBoxUpstreamEffects (#14016)
In some R2R expansions the type handle is not an explicit operand to
the newobj helper. So we must bail out of removal attempts when the
type handle is desired and we see such an expansion.
Closes #13942.
Also likely will fix #13930.
-rw-r--r-- | src/jit/gentree.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/jit/gentree.cpp b/src/jit/gentree.cpp index 67b2fb6ebc..ff7372cce1 100644 --- a/src/jit/gentree.cpp +++ b/src/jit/gentree.cpp @@ -12538,9 +12538,19 @@ GenTree* Compiler::gtTryRemoveBoxUpstreamEffects(GenTree* op, BoxRemovalOptions } else if (asgSrcOper == GT_CALL) { - GenTreeCall* newobjCall = asgSrc->AsCall(); - GenTreeArgList* newobjArgs = newobjCall->gtCallArgs->AsArgList(); - boxTypeHandle = newobjArgs->Current(); + GenTreeCall* newobjCall = asgSrc->AsCall(); + GenTree* newobjArgs = newobjCall->gtCallArgs; + + // In R2R expansions the handle may not be an explicit operand to the helper, + // so we can't remove the box. + if (newobjArgs == nullptr) + { + assert(newobjCall->IsHelperCall(this, CORINFO_HELP_READYTORUN_NEW)); + JITDUMP("bailing; newobj via R2R helper\n"); + return nullptr; + } + + boxTypeHandle = newobjArgs->AsArgList()->Current(); } else { |