Skip to content

Commit f852503

Browse files
authored
[CodeGen] Don't include aliases in RegisterClassInfo::IgnoreCSRForAllocOrder (#80015)
Previously we called ignoreCSRForAllocationOrder on every alias of every CSR which was expensive on targets like AMDGPU which define a very large number of overlapping register tuples. On such targets it is simpler and faster to call ignoreCSRForAllocationOrder once for every physical register. Differential Revision: https://reviews.llvm.org/D146735
1 parent db49319 commit f852503

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

llvm/lib/CodeGen/RegisterClassInfo.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,9 @@ void RegisterClassInfo::runOnMachineFunction(const MachineFunction &mf) {
9393
// Even if CSR list is same, we could have had a different allocation order
9494
// if ignoreCSRForAllocationOrder is evaluated differently.
9595
BitVector CSRHintsForAllocOrder(TRI->getNumRegs());
96-
for (const MCPhysReg *I = CSR; *I; ++I)
97-
for (MCRegAliasIterator AI(*I, TRI, true); AI.isValid(); ++AI)
98-
CSRHintsForAllocOrder[*AI] = STI.ignoreCSRForAllocationOrder(mf, *AI);
99-
if (IgnoreCSRForAllocOrder.size() != CSRHintsForAllocOrder.size() ||
100-
IgnoreCSRForAllocOrder != CSRHintsForAllocOrder) {
96+
for (MCPhysReg I = 1, E = TRI->getNumRegs(); I != E; ++I)
97+
CSRHintsForAllocOrder[I] = STI.ignoreCSRForAllocationOrder(mf, I);
98+
if (IgnoreCSRForAllocOrder != CSRHintsForAllocOrder) {
10199
Update = true;
102100
IgnoreCSRForAllocOrder = CSRHintsForAllocOrder;
103101
}

0 commit comments

Comments
 (0)