[llvm] [PGO] Supporting code for always instrumenting loop entries (PR #116789)

Christian Ulmann via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 19 06:09:41 PST 2024


================
@@ -291,10 +301,13 @@ 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));
----------------
Dinistro wrote:

```suggestion
    assert(!(InstrumentLoopEntries && !LI) && "expected a LoopInfo to instrumenting loop entries");
```
Nit: It's usually considered good practice to add a string to an assert to simplify debugging.

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


More information about the llvm-commits mailing list