[llvm] [AMDGPU] Shrink a live interval instead of recomputing it. NFCI. (PR #108171)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 11 02:15:20 PDT 2024
https://github.com/jayfoad created https://github.com/llvm/llvm-project/pull/108171
None
>From 45ce4817f806c8079f7438029fdfa2a58bcce705 Mon Sep 17 00:00:00 2001
From: Jay Foad <jay.foad at amd.com>
Date: Wed, 11 Sep 2024 10:14:13 +0100
Subject: [PATCH] [AMDGPU] Shrink a live interval instead of recomputing it.
NFCI.
---
llvm/lib/Target/AMDGPU/SIWholeQuadMode.cpp | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/llvm/lib/Target/AMDGPU/SIWholeQuadMode.cpp b/llvm/lib/Target/AMDGPU/SIWholeQuadMode.cpp
index f9d7ead4ff3ecc..38ebda6cde1e59 100644
--- a/llvm/lib/Target/AMDGPU/SIWholeQuadMode.cpp
+++ b/llvm/lib/Target/AMDGPU/SIWholeQuadMode.cpp
@@ -1527,13 +1527,18 @@ bool SIWholeQuadMode::lowerCopyInstrs() {
for (MachineInstr *MI : LowerToCopyInstrs) {
LLVM_DEBUG(dbgs() << "simplify: " << *MI);
- Register RecomputeReg = 0;
if (MI->getOpcode() == AMDGPU::V_SET_INACTIVE_B32 ||
MI->getOpcode() == AMDGPU::V_SET_INACTIVE_B64) {
assert(MI->getNumExplicitOperands() == 3);
+
+ LiveInterval *RecomputeLI = nullptr;
if (MI->getOperand(2).isReg())
- RecomputeReg = MI->getOperand(2).getReg();
+ RecomputeLI = &LIS->getInterval(MI->getOperand(2).getReg());
+
MI->removeOperand(2);
+
+ if (RecomputeLI)
+ LIS->shrinkToUses(RecomputeLI);
} else {
assert(MI->getNumExplicitOperands() == 2);
}
@@ -1550,11 +1555,6 @@ bool SIWholeQuadMode::lowerCopyInstrs() {
MI->setDesc(TII->get(CopyOp));
LLVM_DEBUG(dbgs() << " -> " << *MI);
-
- if (RecomputeReg) {
- LIS->removeInterval(RecomputeReg);
- LIS->createAndComputeVirtRegInterval(RecomputeReg);
- }
}
return !LowerToCopyInstrs.empty() || !LowerToMovInstrs.empty();
}
More information about the llvm-commits
mailing list