summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLubomir Litchev <lubol@microsoft.com>2016-04-14 15:36:25 -0700
committerLubomir Litchev <lubol@microsoft.com>2016-04-15 13:59:38 -0700
commitd07a34f33a862a40a1456cbff245a1e141a7264d (patch)
tree48bb9b31763b324457275b64b0c6df9f7e4dd429 /src
parent0ec739e4416d12eeaac0c365fae09e503b080eaf (diff)
downloadcoreclr-d07a34f33a862a40a1456cbff245a1e141a7264d.tar.gz
coreclr-d07a34f33a862a40a1456cbff245a1e141a7264d.tar.bz2
coreclr-d07a34f33a862a40a1456cbff245a1e141a7264d.zip
Set the lvIsMultiRegArgOrRet for a variable containing the result of
inlined multi-register return call. This change makes sure the lvIsMultiRegArgOrRet on a variable used to store the result of inlined multi-register return function is set. The way the code works today, this is not an issue since the code in fgAttachStructInlineeToAsg always uses a CopyObj/Blk to asign the return value from the registers to the var on stack. The CopyBlock/Obj gets the address of the variable making it address-exposed and that prevents struct promotion. In the future (when CopyObj/Blk is not used) not having lvIsMultiRegArgOrRet set could cause a problem. Fixes issue 4276.
Diffstat (limited to 'src')
-rw-r--r--src/jit/codegenxarch.cpp5
-rw-r--r--src/jit/flowgraph.cpp7
2 files changed, 9 insertions, 3 deletions
diff --git a/src/jit/codegenxarch.cpp b/src/jit/codegenxarch.cpp
index 8e2482f6c6..d8af37721c 100644
--- a/src/jit/codegenxarch.cpp
+++ b/src/jit/codegenxarch.cpp
@@ -2663,9 +2663,8 @@ CodeGen::genMultiRegCallStoreToLocal(GenTreePtr treeNode)
// var in 'var = call' is flagged as lvIsMultiRegArgOrRet to prevent it from
// being struct poromoted.
//
- // TODO-BUG: Crossgen of mscorlib fires the below assert.
- // A git issue is opened for investigating this.
- // noway_assert(varDsc->lvIsMultiRegArgOrRet);
+
+ noway_assert(varDsc->lvIsMultiRegArgOrRet);
getEmitter()->emitIns_S_R(ins_Store(type0), emitTypeSize(type0), reg0, lclNum, 0);
getEmitter()->emitIns_S_R(ins_Store(type1), emitTypeSize(type1), reg1, lclNum, 8);
diff --git a/src/jit/flowgraph.cpp b/src/jit/flowgraph.cpp
index ceba942847..74821ec079 100644
--- a/src/jit/flowgraph.cpp
+++ b/src/jit/flowgraph.cpp
@@ -21674,6 +21674,13 @@ GenTreePtr Compiler::fgAssignStructInlineeToVar(GenTreePtr child, CORINFO_CLASS_
// If inlinee was just a call, new inlinee is v05 = call()
newInlinee = gtNewAssignNode(dst, src);
+ // When returning a multi-register value in a local var, make sure the variable is
+ // marked as lvIsMultiRegArgOrRet, so it does not get promoted.
+ if (src->AsCall()->HasMultiRegRetVal())
+ {
+ lvaTable[tmpNum].lvIsMultiRegArgOrRet = true;
+ }
+
// If inlinee was comma, but a deeper call, new inlinee is (, , , v05 = call())
if (child->gtOper == GT_COMMA)
{