Skip to content

Commit

Permalink
amend the code for CR.
Browse files Browse the repository at this point in the history
  • Loading branch information
shushanhf committed May 16, 2023
1 parent 7caaa18 commit 4dcd720
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/coreclr/jit/lsra.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8155,8 +8155,6 @@ void LinearScan::handleOutgoingCriticalEdges(BasicBlock* block)
if (lastNode->OperIs(GT_JTRUE, GT_JCMP, GT_JTEST))
{
GenTree* op = lastNode->gtGetOp1();

Consume_Op2:
consumedRegs |= genRegMask(op->GetRegNum());

if (op->OperIs(GT_COPY))
Expand All @@ -8170,16 +8168,22 @@ void LinearScan::handleOutgoingCriticalEdges(BasicBlock* block)
terminatorNodeLclVarDsc = &compiler->lvaTable[lcl->GetLclNum()];
}

if (!lastNode->gtGetOp2()->isContainedIntOrIImmed() && (op != lastNode->gtGetOp2()))
if (lastNode->OperIs(GT_JCMP, GT_JTEST) && !lastNode->gtGetOp2()->isContained())
{
op = lastNode->gtGetOp2();
goto Consume_Op2;
}
consumedRegs |= genRegMask(op->GetRegNum());

#if !defined(TARGET_LOONGARCH64) && !defined(TARGET_RISCV64)
// For LoongArch64/RISC-V, the second operand of a JCMP can be in a register too.
assert(!lastNode->OperIs(GT_JCMP, GT_JTEST) || lastNode->gtGetOp2()->isContained());
#endif
if (op->OperIs(GT_COPY))
{
GenTree* srcOp = op->gtGetOp1();
consumedRegs |= genRegMask(srcOp->GetRegNum());
}
else if (op->IsLocal())
{
GenTreeLclVarCommon* lcl = op->AsLclVarCommon();
terminatorNodeLclVarDsc = &compiler->lvaTable[lcl->GetLclNum()];
}
}
}
}

Expand Down

0 comments on commit 4dcd720

Please sign in to comment.