[llvm] 0affe0c - Revert "[AMDGPU] Speedup GCNDownwardRPTracker::advanceBeforeNext"
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 2 06:18:29 PST 2022
Author: Jay Foad
Date: 2022-12-02T14:18:16Z
New Revision: 0affe0c8cf199d1b00503f5babfa2bebb508329f
URL: https://github.com/llvm/llvm-project/commit/0affe0c8cf199d1b00503f5babfa2bebb508329f
DIFF: https://github.com/llvm/llvm-project/commit/0affe0c8cf199d1b00503f5babfa2bebb508329f.diff
LOG: Revert "[AMDGPU] Speedup GCNDownwardRPTracker::advanceBeforeNext"
This reverts commit 2d09bec169277fb5a341249afacff532c7511756.
It was causing assertion failures in some out-of-tree tests.
Added:
Modified:
llvm/lib/Target/AMDGPU/GCNRegPressure.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/GCNRegPressure.cpp b/llvm/lib/Target/AMDGPU/GCNRegPressure.cpp
index 4b055d883e389..f9bed9a76c6fb 100644
--- a/llvm/lib/Target/AMDGPU/GCNRegPressure.cpp
+++ b/llvm/lib/Target/AMDGPU/GCNRegPressure.cpp
@@ -336,38 +336,23 @@ bool GCNDownwardRPTracker::advanceBeforeNext() {
assert(SI.isValid());
// Remove dead registers or mask bits.
- SmallSet<Register, 8> SeenRegs;
- for (auto &MO : LastTrackedMI->operands()) {
- if (!MO.isReg() || !MO.getReg().isVirtual())
- continue;
- if (MO.isUse() && !MO.readsReg())
- continue;
- if (!SeenRegs.insert(MO.getReg()).second)
- continue;
- const LiveInterval &LI = LIS.getInterval(MO.getReg());
+ for (auto &It : LiveRegs) {
+ const LiveInterval &LI = LIS.getInterval(It.first);
if (LI.hasSubRanges()) {
- auto It = LiveRegs.end();
for (const auto &S : LI.subranges()) {
if (!S.liveAt(SI)) {
- if (It == LiveRegs.end()) {
- It = LiveRegs.find(MO.getReg());
- if (It == LiveRegs.end())
- llvm_unreachable("register isn't live");
- }
- auto PrevMask = It->second;
- It->second &= ~S.LaneMask;
- CurPressure.inc(MO.getReg(), PrevMask, It->second, *MRI);
+ auto PrevMask = It.second;
+ It.second &= ~S.LaneMask;
+ CurPressure.inc(It.first, PrevMask, It.second, *MRI);
}
}
- if (It != LiveRegs.end() && It->second.none())
- LiveRegs.erase(It);
} else if (!LI.liveAt(SI)) {
- auto It = LiveRegs.find(MO.getReg());
- if (It == LiveRegs.end())
- llvm_unreachable("register isn't live");
- CurPressure.inc(MO.getReg(), It->second, LaneBitmask::getNone(), *MRI);
- LiveRegs.erase(It);
+ auto PrevMask = It.second;
+ It.second = LaneBitmask::getNone();
+ CurPressure.inc(It.first, PrevMask, It.second, *MRI);
}
+ if (It.second.none())
+ LiveRegs.erase(It.first);
}
MaxPressure = max(MaxPressure, CurPressure);
More information about the llvm-commits
mailing list