Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 94b08b7

Browse files
committed
Set reg conflicts on contained IND
For shift, rotate, mod and div, we were only excluding conflicting registers on the non-fixed operand if it is not contained. However, we still want to do that for the base and index (if any) on a contained IND. Also, fix the LocationInfoListNodePool to attribute its memory usage to CMK_LSRA.
1 parent 8867f59 commit 94b08b7

File tree

2 files changed

+33
-4
lines changed

2 files changed

+33
-4
lines changed

src/jit/lsra.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3387,8 +3387,9 @@ class LocationInfoListNodePool final
33873387
{
33883388
if (preallocate > 0)
33893389
{
3390-
size_t preallocateSize = sizeof(LocationInfoListNode) * preallocate;
3391-
auto* preallocatedNodes = reinterpret_cast<LocationInfoListNode*>(compiler->compGetMem(preallocateSize));
3390+
size_t preallocateSize = sizeof(LocationInfoListNode) * preallocate;
3391+
LocationInfoListNode* preallocatedNodes =
3392+
reinterpret_cast<LocationInfoListNode*>(compiler->compGetMem(preallocateSize, CMK_LSRA));
33923393

33933394
LocationInfoListNode* head = preallocatedNodes;
33943395
head->m_next = nullptr;

src/jit/lsraxarch.cpp

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,21 @@ void LinearScan::TreeNodeInfoInitShiftRotate(GenTree* tree)
10131013
if (!shiftBy->isContained())
10141014
{
10151015
shiftBy->gtLsraInfo.setSrcCandidates(this, RBM_RCX);
1016-
if (!source->isContained())
1016+
if (source->isContained())
1017+
{
1018+
if (source->OperIs(GT_IND))
1019+
{
1020+
if (source->AsIndir()->Base() != nullptr)
1021+
{
1022+
source->AsIndir()->Base()->gtLsraInfo.setSrcCandidates(this, allRegs(TYP_INT) & ~RBM_RCX);
1023+
}
1024+
if (source->AsIndir()->Index() != nullptr)
1025+
{
1026+
source->AsIndir()->Index()->gtLsraInfo.setSrcCandidates(this, allRegs(TYP_INT) & ~RBM_RCX);
1027+
}
1028+
}
1029+
}
1030+
else
10171031
{
10181032
source->gtLsraInfo.setSrcCandidates(this, allRegs(TYP_INT) & ~RBM_RCX);
10191033
}
@@ -1932,7 +1946,21 @@ void LinearScan::TreeNodeInfoInitModDiv(GenTree* tree)
19321946
op1->gtLsraInfo.setSrcCandidates(this, RBM_RAX);
19331947
}
19341948

1935-
if (!op2->isContained())
1949+
if (op2->isContained())
1950+
{
1951+
if (op2->gtOper == GT_IND)
1952+
{
1953+
if (op2->AsIndir()->Base() != nullptr)
1954+
{
1955+
op2->AsIndir()->Base()->gtLsraInfo.setSrcCandidates(this, allRegs(TYP_INT) & ~(RBM_RAX | RBM_RDX));
1956+
}
1957+
if (op2->AsIndir()->Index() != nullptr)
1958+
{
1959+
op2->AsIndir()->Index()->gtLsraInfo.setSrcCandidates(this, allRegs(TYP_INT) & ~(RBM_RAX | RBM_RDX));
1960+
}
1961+
}
1962+
}
1963+
else
19361964
{
19371965
op2->gtLsraInfo.setSrcCandidates(this, allRegs(TYP_INT) & ~(RBM_RAX | RBM_RDX));
19381966
}

0 commit comments

Comments
 (0)