[llvm-branch-commits] [llvm] [LVer][profcheck] explicitly set unknown branch weights for the versioned/unversioned selector (PR #164507)
Florian Hahn via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sat Nov 1 14:36:22 PDT 2025
================
@@ -109,8 +110,13 @@ void LoopVersioning::versionLoop(
// Insert the conditional branch based on the result of the memchecks.
Instruction *OrigTerm = RuntimeCheckBB->getTerminator();
Builder.SetInsertPoint(OrigTerm);
- Builder.CreateCondBr(RuntimeCheck, NonVersionedLoop->getLoopPreheader(),
- VersionedLoop->getLoopPreheader());
+ auto *BI =
+ Builder.CreateCondBr(RuntimeCheck, NonVersionedLoop->getLoopPreheader(),
+ VersionedLoop->getLoopPreheader());
+ // We don't know what the probability of executing the versioned vs the
+ // unversioned variants is.
+ setExplicitlyUnknownBranchWeightsIfProfiled(
+ *BI, *BI->getParent()->getParent(), DEBUG_TYPE);
----------------
fhahn wrote:
```suggestion
*BI, *BI->getFunction(), DEBUG_TYPE);
```
https://github.com/llvm/llvm-project/pull/164507
More information about the llvm-branch-commits
mailing list