[compiler-rt] [llvm] [PGO] Add option to always instrumenting loop entries (PR #116789)

Ellis Hoag via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 25 10:20:14 PST 2024


================
@@ -291,10 +301,14 @@ template <class Edge, class BBInfo> class CFGMST {
     return *AllEdges.back();
   }
 
-  CFGMST(Function &Func, bool InstrumentFuncEntry,
+  CFGMST(Function &Func, bool InstrumentFuncEntry, bool InstrumentLoopEntries,
          BranchProbabilityInfo *BPI = nullptr,
-         BlockFrequencyInfo *BFI = nullptr)
-      : F(Func), BPI(BPI), BFI(BFI), InstrumentFuncEntry(InstrumentFuncEntry) {
+         BlockFrequencyInfo *BFI = nullptr, LoopInfo *LI = nullptr)
+      : F(Func), BPI(BPI), BFI(BFI), LI(LI),
+        InstrumentFuncEntry(InstrumentFuncEntry),
+        InstrumentLoopEntries(InstrumentLoopEntries) {
+    assert(!(InstrumentLoopEntries && !LI) &&
+           "expected a LoopInfo to instrumenting loop entries");
     buildEdges();
     sortEdgesByWeight();
     computeMinimumSpanningTree();
----------------
ellishg wrote:

If `InstrumentLoopEntries` is true, then each loop entry should be instrumented. I'm asking if we should add a compile time assert that indeed each loop entry will be instrumented after we compute the minimum spanning tree.

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


More information about the llvm-commits mailing list