Skip to content

Commit 7a5b8b0

Browse files
committed
[SLU][profcheck] Propagate profile for branches on injected conditions.
1 parent 472b932 commit 7a5b8b0

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
@@ -3203,10 +3203,15 @@ injectPendingInvariantConditions(NonTrivialUnswitchCandidate Candidate, Loop &L,
32033203
Builder.SetInsertPoint(TI);
32043204
auto *InvariantBr =
32053205
Builder.CreateCondBr(InjectedCond, InLoopSucc, CheckBlock);
3206+
// We don't know anything about the relation between the limits.
3207+
setExplicitlyUnknownBranchWeightsIfProfiled(
3208+
*InvariantBr, *InvariantBr->getParent()->getParent(), DEBUG_TYPE);
32063209

32073210
Builder.SetInsertPoint(CheckBlock);
3208-
Builder.CreateCondBr(TI->getCondition(), TI->getSuccessor(0),
3209-
TI->getSuccessor(1));
3211+
Builder.CreateCondBr(
3212+
TI->getCondition(), TI->getSuccessor(0), TI->getSuccessor(1),
3213+
!ProfcheckDisableMetadataFixes ? TI->getMetadata(LLVMContext::MD_prof)
3214+
: nullptr);
32103215
TI->eraseFromParent();
32113216

32123217
// Fixup phis.

0 commit comments

Comments
 (0)