Skip to content

Commit 85789bb

Browse files
committed
[SLU][profcheck] Propagate profile for branches on injected conditions.
1 parent 7fb0459 commit 85789bb

File tree

2 files changed

+77
-71
lines changed

2 files changed

+77
-71
lines changed

llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3195,10 +3195,14 @@ injectPendingInvariantConditions(NonTrivialUnswitchCandidate Candidate, Loop &L,
31953195
Builder.SetInsertPoint(TI);
31963196
auto *InvariantBr =
31973197
Builder.CreateCondBr(InjectedCond, InLoopSucc, CheckBlock);
3198+
// We don't know anything about the relation between the limits.
3199+
setExplicitlyUnknownBranchWeightsIfProfiled(
3200+
*InvariantBr, *InvariantBr->getParent()->getParent(), DEBUG_TYPE);
31983201

31993202
Builder.SetInsertPoint(CheckBlock);
32003203
Builder.CreateCondBr(TI->getCondition(), TI->getSuccessor(0),
3201-
TI->getSuccessor(1));
3204+
TI->getSuccessor(1),
3205+
TI->getMetadata(LLVMContext::MD_prof));
32023206
TI->eraseFromParent();
32033207

32043208
// Fixup phis.

0 commit comments

Comments
 (0)