Skip to content

Commit f696a5d

Browse files
committed
[SLU][profcheck] Propagate profile for branches on injected conditions.
1 parent 466d5f3 commit f696a5d

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

32053208
Builder.SetInsertPoint(CheckBlock);
3206-
Builder.CreateCondBr(TI->getCondition(), TI->getSuccessor(0),
3207-
TI->getSuccessor(1));
3209+
Builder.CreateCondBr(
3210+
TI->getCondition(), TI->getSuccessor(0), TI->getSuccessor(1),
3211+
!ProfcheckDisableMetadataFixes ? TI->getMetadata(LLVMContext::MD_prof)
3212+
: nullptr);
32083213
TI->eraseFromParent();
32093214

32103215
// Fixup phis.

0 commit comments

Comments
 (0)