Skip to content

Commit 7caaa18

Browse files
committed
Fix the regs conflicts within the addResolution for LoongArch64/RISC-V.
1 parent 115a475 commit 7caaa18

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/coreclr/jit/lsra.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8155,23 +8155,29 @@ void LinearScan::handleOutgoingCriticalEdges(BasicBlock* block)
81558155
if (lastNode->OperIs(GT_JTRUE, GT_JCMP, GT_JTEST))
81568156
{
81578157
GenTree* op = lastNode->gtGetOp1();
8158+
8159+
Consume_Op2:
81588160
consumedRegs |= genRegMask(op->GetRegNum());
81598161

81608162
if (op->OperIs(GT_COPY))
81618163
{
81628164
GenTree* srcOp = op->gtGetOp1();
81638165
consumedRegs |= genRegMask(srcOp->GetRegNum());
81648166
}
8165-
8166-
if (op->IsLocal())
8167+
else if (op->IsLocal())
81678168
{
81688169
GenTreeLclVarCommon* lcl = op->AsLclVarCommon();
81698170
terminatorNodeLclVarDsc = &compiler->lvaTable[lcl->GetLclNum()];
81708171
}
81718172

8173+
if (!lastNode->gtGetOp2()->isContainedIntOrIImmed() && (op != lastNode->gtGetOp2()))
8174+
{
8175+
op = lastNode->gtGetOp2();
8176+
goto Consume_Op2;
8177+
}
8178+
81728179
#if !defined(TARGET_LOONGARCH64) && !defined(TARGET_RISCV64)
8173-
// TODO-LOONGARCH64: Take into account that on LA64, the second
8174-
// operand of a JCMP can be in a register too.
8180+
// For LoongArch64/RISC-V, the second operand of a JCMP can be in a register too.
81758181
assert(!lastNode->OperIs(GT_JCMP, GT_JTEST) || lastNode->gtGetOp2()->isContained());
81768182
#endif
81778183
}

0 commit comments

Comments
 (0)