[llvm] [CodeGen] Don't include aliases in RegisterClassInfo::IgnoreCSRForAllocOrder (PR #80015)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 30 06:54:41 PST 2024
https://github.com/jayfoad created https://github.com/llvm/llvm-project/pull/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
>From 1df285291bd95e0e420f70ff0f74409686485a7d Mon Sep 17 00:00:00 2001
From: Jay Foad <jay.foad at amd.com>
Date: Thu, 23 Mar 2023 16:23:00 +0000
Subject: [PATCH] [CodeGen] Don't include aliases in
RegisterClassInfo::IgnoreCSRForAllocOrder
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
---
llvm/lib/CodeGen/RegisterClassInfo.cpp | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/llvm/lib/CodeGen/RegisterClassInfo.cpp b/llvm/lib/CodeGen/RegisterClassInfo.cpp
index 8869a861de061..1dd595bc140cb 100644
--- a/llvm/lib/CodeGen/RegisterClassInfo.cpp
+++ b/llvm/lib/CodeGen/RegisterClassInfo.cpp
@@ -93,11 +93,9 @@ void RegisterClassInfo::runOnMachineFunction(const MachineFunction &mf) {
// Even if CSR list is same, we could have had a different allocation order
// if ignoreCSRForAllocationOrder is evaluated differently.
BitVector CSRHintsForAllocOrder(TRI->getNumRegs());
- for (const MCPhysReg *I = CSR; *I; ++I)
- for (MCRegAliasIterator AI(*I, TRI, true); AI.isValid(); ++AI)
- CSRHintsForAllocOrder[*AI] = STI.ignoreCSRForAllocationOrder(mf, *AI);
- if (IgnoreCSRForAllocOrder.size() != CSRHintsForAllocOrder.size() ||
- IgnoreCSRForAllocOrder != CSRHintsForAllocOrder) {
+ for (MCPhysReg I = 1, E = TRI->getNumRegs(); I != E; ++I)
+ CSRHintsForAllocOrder[I] = STI.ignoreCSRForAllocationOrder(mf, I);
+ if (IgnoreCSRForAllocOrder != CSRHintsForAllocOrder) {
Update = true;
IgnoreCSRForAllocOrder = CSRHintsForAllocOrder;
}
More information about the llvm-commits
mailing list