[PATCH] D82123: [PGO] Add a functionality to always instrument the func entry BB

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 18 14:15:16 PDT 2020


davidxl added inline comments.


================
Comment at: llvm/lib/Transforms/Instrumentation/CFGMST.h:110
+    // If we want to instrument the entry count, lower the weight to 0.
+    if (PGOInstrumentEntry)
+      EntryWeight = 0;
----------------
Does this guarantee entry be instrumented?


================
Comment at: llvm/lib/Transforms/Instrumentation/CFGMST.h:147
             Weight = BPI->getEdgeProbability(&*BB, TargetBB).scale(scaleFactor);
+          if (Weight == 0)
+            Weight++;
----------------
Is this the way to make sure entry is always instrumented?


================
Comment at: llvm/lib/Transforms/Instrumentation/CFGMST.h:292
     computeMinimumSpanningTree();
+    if (PGOInstrumentEntry && (AllEdges.size() > 1))
+      std::iter_swap(std::move(AllEdges.begin()),
----------------
is this needed? Can somthing be done in CompputeMST without relying on weight trick?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82123/new/

https://reviews.llvm.org/D82123





More information about the llvm-commits mailing list