[llvm] 0a1c663 - [GreedyRA ORE] Compute ORE stats if extra analysis is enabled

Serguei Katkov via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 8 00:24:35 PDT 2021


Author: Serguei Katkov
Date: 2021-04-08T14:24:18+07:00
New Revision: 0a1c6637a1e89ca757e69225f6ead27bf151a16b

URL: https://github.com/llvm/llvm-project/commit/0a1c6637a1e89ca757e69225f6ead27bf151a16b
DIFF: https://github.com/llvm/llvm-project/commit/0a1c6637a1e89ca757e69225f6ead27bf151a16b.diff

LOG: [GreedyRA ORE] Compute ORE stats if extra analysis is enabled

To save compile time, avoid computation of stats if ORE will not emit it.
The motivation is to add more stats and compute it only if it will dumped.

Reviewers: reames, MatzeB, anemet, thegameg
Reviewed By: reames
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D100010

Added: 
    

Modified: 
    llvm/lib/CodeGen/RegAllocGreedy.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/RegAllocGreedy.cpp b/llvm/lib/CodeGen/RegAllocGreedy.cpp
index 26e7a1f17a22..d3a9aeb66d96 100644
--- a/llvm/lib/CodeGen/RegAllocGreedy.cpp
+++ b/llvm/lib/CodeGen/RegAllocGreedy.cpp
@@ -552,13 +552,7 @@ class RAGreedy : public MachineFunctionPass,
                                     unsigned &FoldedSpills);
 
   /// Report the number of spills and reloads for each loop.
-  void reportNumberOfSplillsReloads() {
-    for (MachineLoop *L : *Loops) {
-      unsigned Reloads, FoldedReloads, Spills, FoldedSpills;
-      reportNumberOfSplillsReloads(L, Reloads, FoldedReloads, Spills,
-                                   FoldedSpills);
-    }
-  }
+  void reportNumberOfSplillsReloads();
 };
 
 } // end anonymous namespace
@@ -3183,6 +3177,16 @@ void RAGreedy::reportNumberOfSplillsReloads(MachineLoop *L, unsigned &Reloads,
   }
 }
 
+void RAGreedy::reportNumberOfSplillsReloads() {
+  if (!ORE->allowExtraAnalysis(DEBUG_TYPE))
+    return;
+  for (MachineLoop *L : *Loops) {
+    unsigned Reloads, FoldedReloads, Spills, FoldedSpills;
+    reportNumberOfSplillsReloads(L, Reloads, FoldedReloads, Spills,
+                                 FoldedSpills);
+  }
+}
+
 bool RAGreedy::runOnMachineFunction(MachineFunction &mf) {
   LLVM_DEBUG(dbgs() << "********** GREEDY REGISTER ALLOCATION **********\n"
                     << "********** Function: " << mf.getName() << '\n');


        


More information about the llvm-commits mailing list