[PATCH] D100014: [GreedyRA ORE] Add function level spill/reloads stats

Serguei Katkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 6 21:37:35 PDT 2021


skatkov created this revision.
skatkov added reviewers: reames, MatzeB, anemet.
Herald added subscribers: dantrushin, hiraditya, qcolombet.
skatkov requested review of this revision.
Herald added a project: LLVM.

https://reviews.llvm.org/D100014

Files:
  llvm/lib/CodeGen/RegAllocGreedy.cpp


Index: llvm/lib/CodeGen/RegAllocGreedy.cpp
===================================================================
--- llvm/lib/CodeGen/RegAllocGreedy.cpp
+++ llvm/lib/CodeGen/RegAllocGreedy.cpp
@@ -3196,8 +3196,24 @@
 void RAGreedy::reportNumberOfSplillsReloads() {
   if (!ORE->allowExtraAnalysis(DEBUG_TYPE))
     return;
+  RAGreedyStats Stats;
   for (MachineLoop *L : *Loops)
-    reportNumberOfSplillsReloads(L);
+    Stats.add(reportNumberOfSplillsReloads(L));
+  // Process non-loop blocks.
+  for (MachineBasicBlock &MBB : *MF)
+    if (!Loops->getLoopFor(&MBB))
+      Stats.add(computeNumberOfSplillsReloads(MBB));
+  if (!Stats.isEmpty()) {
+    using namespace ore;
+
+    ORE->emit([&]() {
+      MachineOptimizationRemarkMissed R(DEBUG_TYPE, "SpillReload", DebugLoc(),
+                                        &MF->front());
+      Stats.report(R);
+      R << "generated in function";
+      return R;
+    });
+  }
 }
 
 bool RAGreedy::runOnMachineFunction(MachineFunction &mf) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100014.335717.patch
Type: text/x-patch
Size: 994 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210407/3feb7841/attachment.bin>


More information about the llvm-commits mailing list