[llvm] [AMDGPU] NFC: Add BBLiveOutMap & LiveOut Cache (PR #93089)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 14 12:46:06 PDT 2024


================
@@ -613,7 +627,32 @@ 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());
+  for (auto &[RegionBegin, RegionEnd] : reverse(Regions))
+    BBEnders.push_back(getLastMIForRegion(RegionBegin, RegionEnd));
+
+  return getLiveRegMap(BBEnders, /*After= */ true, *LIS);
+}
+
+void RegionPressureMap::buildLiveRegMap() {
+  IdxToInstruction.clear();
+  BBLiveRegMap.clear();
----------------
arsenm wrote:

Why do you need to clear this if you're just going to reassign it right after? 

https://github.com/llvm/llvm-project/pull/93089


More information about the llvm-commits mailing list