[llvm] [SLU][profcheck] Use the original branch weigths in `buildPartialInvariantUnswitchConditionalBranch` (PR #164270)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 30 10:55:59 PDT 2025
================
@@ -377,8 +377,17 @@ static void buildPartialInvariantUnswitchConditionalBranch(
IRBuilder<> IRB(&BB);
IRB.SetCurrentDebugLocation(DebugLoc::getCompilerGenerated());
Value *Cond = VMap[ToDuplicate[0]];
- IRB.CreateCondBr(Cond, Direction ? &UnswitchedSucc : &NormalSucc,
- Direction ? &NormalSucc : &UnswitchedSucc);
+ auto *ProfData =
+ !ProfcheckDisableMetadataFixes &&
+ ToDuplicate[0] == skipTrivialSelect(OriginalBranch.getCondition())
+ ? OriginalBranch.getMetadata(LLVMContext::MD_prof)
+ : nullptr;
----------------
fhahn wrote:
This logic should probably have a comment explaining what's going on.
https://github.com/llvm/llvm-project/pull/164270
More information about the llvm-commits
mailing list