Skip to content

Commit 54eacf7

Browse files
committed
[SLU][profcheck] Propagate profile for branches on injected conditions.
1 parent 7967c99 commit 54eacf7

File tree

2 files changed

+79
-72
lines changed

2 files changed

+79
-72
lines changed

llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3199,10 +3199,15 @@ injectPendingInvariantConditions(NonTrivialUnswitchCandidate Candidate, Loop &L,
31993199
Builder.SetInsertPoint(TI);
32003200
auto *InvariantBr =
32013201
Builder.CreateCondBr(InjectedCond, InLoopSucc, CheckBlock);
3202+
// We don't know anything about the relation between the limits.
3203+
setExplicitlyUnknownBranchWeightsIfProfiled(
3204+
*InvariantBr, *InvariantBr->getParent()->getParent(), DEBUG_TYPE);
32023205

32033206
Builder.SetInsertPoint(CheckBlock);
3204-
Builder.CreateCondBr(TI->getCondition(), TI->getSuccessor(0),
3205-
TI->getSuccessor(1));
3207+
Builder.CreateCondBr(
3208+
TI->getCondition(), TI->getSuccessor(0), TI->getSuccessor(1),
3209+
!ProfcheckDisableMetadataFixes ? TI->getMetadata(LLVMContext::MD_prof)
3210+
: nullptr);
32063211
TI->eraseFromParent();
32073212

32083213
// Fixup phis.

0 commit comments

Comments
 (0)