[llvm] [AMDGPU] NFC: Add BBLiveOutMap & LiveOut Cache (PR #93089)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri May 31 03:26:34 PDT 2024
================
@@ -613,7 +627,37 @@ GCNScheduleDAGMILive::getBBLiveInMap() const {
++I;
} while (I != E && I->first->getParent() == BB);
} while (I != E);
- return getLiveRegMap(BBStarters, false /*After*/, *LIS);
+ return getLiveRegMap(BBStarters, /*After=*/false, *LIS);
+}
+
+DenseMap<MachineInstr *, GCNRPTracker::LiveRegSet>
+GCNScheduleDAGMILive::getBBLiveOutMap() const {
+ assert(!Regions.empty());
+ std::vector<MachineInstr *> BBEnders;
+ BBEnders.reserve(Regions.size());
+ auto I = Regions.rbegin(), E = Regions.rend();
+ for (; I != E; I++)
+ BBEnders.push_back(getLastMIForRegion(I->first, I->second));
+
+ return getLiveRegMap(BBEnders, /*After= */ true, *LIS);
+}
+
+void RegionPressureMap::buildLiveRegMap() {
+ if (IsMapGenerated) {
+ IdxToInstruction.clear();
+ BBLiveRegMap.clear();
+ IsMapGenerated = false;
+ }
+
+ BBLiveRegMap = IsLiveOut ? DAG->getBBLiveOutMap() : DAG->getBBLiveInMap();
+ for (unsigned I = 0; I < DAG->Regions.size(); I++) {
+ MachineInstr *RegionKey;
+ RegionKey = IsLiveOut ? getLastMIForRegion(DAG->Regions[I].first,
----------------
arsenm wrote:
Declare and initialize at once
https://github.com/llvm/llvm-project/pull/93089
More information about the llvm-commits
mailing list