Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc8fbaff

Browse files
jakobbotschVSadov
authored andcommitted
JIT: Handle multi-reg async calls stored to promoted locals
In some cases the async transformation needs to introduce a new local tostore the result of an async call to. If the previous store was amulti-reg call stored to an independently promoted local then we wouldproduce illegal IR. For example, the IR``` t79 = ▌ CALL struct <unknown method> (async) $702 ┌──▌ t79 struct ▌ STORE_LCL_VAR struct<System.ValueTuple`3, 16>(P) V25 tmp9 ▌ ref field V25.Item3 (fldOffset=0x0) -> V275 tmp259 d:2 ▌ int field V25.Item2 (fldOffset=0x8) -> V276 tmp260 d:1 ▌ ubyte field V25.Item1 (fldOffset=0xc) -> V277 tmp261 d:1 $VN.Void```would be canonicalized into``` t79 = ▌ CALL struct <unknown method> (async) $702 ┌──▌ t79 struct ▌ STORE_LCL_VAR struct<System.ValueTuple`3, 16> V337 rat6t5027 = LCL_VAR struct<System.ValueTuple`3, 16> V337 rat6 ┌──▌ t5027 struct ▌ STORE_LCL_VAR struct<System.ValueTuple`3, 16>(P) V25 tmp9 ▌ ref field V25.Item3 (fldOffset=0x0) -> V275 tmp259 d:2 ▌ int field V25.Item2 (fldOffset=0x8) -> V276 tmp260 d:1 ▌ ubyte field V25.Item1 (fldOffset=0xc) -> V277 tmp261 d:1 $VN.Void```but that store to the promoted local with a LCL_VAR source is not legal.Fix the problem by decomposing the store when necessary.
1 parent6d1a395 commitc8fbaff

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

‎src/coreclr/jit/async.cpp‎

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1347,7 +1347,33 @@ CallDefinitionInfo AsyncTransformation::CanonicalizeCallDefinition(BasicBlock*
13471347
bool gotUse =LIR::AsRange(block).TryGetUse(call, &use);
13481348
assert(gotUse);
13491349

1350-
use.ReplaceWithLclVar(m_comp);
1350+
unsigned newLclNum = use.ReplaceWithLclVar(m_comp);
1351+
1352+
// In some cases we may have been assigning a multireg promoted local from the call.
1353+
// That's not supported with a LCL_VAR source. We need to decompose.
1354+
if (call->IsMultiRegCall() && use.User()->OperIs(GT_STORE_LCL_VAR))
1355+
{
1356+
LclVarDsc* dsc = m_comp->lvaGetDesc(use.User()->AsLclVar());
1357+
if (m_comp->lvaGetPromotionType(dsc) == Compiler::PROMOTION_TYPE_INDEPENDENT)
1358+
{
1359+
JITDUMP(" Call is multi-reg stored to an independently promoted local; decomposing store\n");
1360+
for (unsigned i =0; i < dsc->lvFieldCnt; i++)
1361+
{
1362+
unsigned fieldLclNum = dsc->lvFieldLclStart + i;
1363+
LclVarDsc* fieldDsc = m_comp->lvaGetDesc(fieldLclNum);
1364+
1365+
GenTree* value = m_comp->gtNewLclFldNode(newLclNum, fieldDsc->TypeGet(), fieldDsc->lvFldOffset);
1366+
GenTree* store = m_comp->gtNewStoreLclVarNode(fieldLclNum, value);
1367+
LIR::AsRange(block).InsertBefore(use.User(), value, store);
1368+
DISPTREERANGE(LIR::AsRange(block), store);
1369+
}
1370+
1371+
// Remove the store that was created by ReplaceWithLclVar above
1372+
assert(use.Def()->OperIs(GT_LCL_VAR));
1373+
LIR::AsRange(block).Remove(use.Def());
1374+
LIR::AsRange(block).Remove(use.User());
1375+
}
1376+
}
13511377
}
13521378
else
13531379
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp