[llvm] [PGO] Add `llvm.loop.estimated_trip_count` metadata (PR #148758)

Mircea Trofin via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 21 08:27:13 PDT 2025


================
@@ -1268,8 +1269,13 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level,
     MPM.addPass(MemProfUsePass(PGOOpt->MemoryProfile, PGOOpt->FS));
 
   if (PGOOpt && (PGOOpt->Action == PGOOptions::IRUse ||
-                 PGOOpt->Action == PGOOptions::SampleUse))
+                 PGOOpt->Action == PGOOptions::SampleUse)) {
     MPM.addPass(PGOForceFunctionAttrsPass(PGOOpt->ColdOptType));
+    // TODO: Is this the right place for this pass?  Should we enable it in any
----------------
mtrofin wrote:

BPI/BFI can be guesstimated in the absence of metadata, too. For consistency, should the loop trip count metadata also be present in those cases? Meaning, I'd propose "just executing it" here, regardless of profile presence or not, wdyt?

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


More information about the llvm-commits mailing list