Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/coreclr/jit/lsraxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2965,8 +2965,18 @@ int LinearScan::BuildHWIntrinsic(GenTreeHWIntrinsic* intrinsicTree, int* pDstCou
}
#endif // TARGET_AMD64

srcCount += isRMW ? BuildDelayFreeUses(op3, op1, op3RegCandidates)
: BuildOperandUses(op3, op3RegCandidates);
if (op3->OperIs(GT_HWINTRINSIC) && op3->AsHWIntrinsic()->OperIsMemoryLoad() && op3->isContained())
{
srcCount += BuildAddrUses(op3->AsHWIntrinsic()->Op(1), op3RegCandidates);
Comment on lines +2968 to +2970
Copy link

Copilot AI Jun 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider caching the result of op3->AsHWIntrinsic() in a local variable to improve readability and potentially reduce redundant method calls. For example, store the cast result in a variable and then reuse it within the conditional block.

Suggested change
if (op3->OperIs(GT_HWINTRINSIC) && op3->AsHWIntrinsic()->OperIsMemoryLoad() && op3->isContained())
{
srcCount += BuildAddrUses(op3->AsHWIntrinsic()->Op(1), op3RegCandidates);
auto op3HWIntrinsic = op3->AsHWIntrinsic();
if (op3->OperIs(GT_HWINTRINSIC) && op3HWIntrinsic->OperIsMemoryLoad() && op3->isContained())
{
srcCount += BuildAddrUses(op3HWIntrinsic->Op(1), op3RegCandidates);

Copilot uses AI. Check for mistakes.
}
else if (isRMW)
{
srcCount += BuildDelayFreeUses(op3, op1, op3RegCandidates);
}
else
{
srcCount += BuildOperandUses(op3, op3RegCandidates);
}

if (op4 != nullptr)
{
Expand Down
Loading