File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
llvm/lib/Transforms/Scalar Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -377,6 +377,8 @@ static void buildPartialInvariantUnswitchConditionalBranch(
377377 IRBuilder<> IRB (&BB);
378378 IRB.SetCurrentDebugLocation (DebugLoc::getCompilerGenerated ());
379379 Value *Cond = VMap[ToDuplicate[0 ]];
380+ // The expectation is that ToDuplicate[0] is the condition used by the
381+ // OriginalBranch, case in which we can clone the profile metadata from there.
380382 auto *ProfData =
381383 !ProfcheckDisableMetadataFixes &&
382384 ToDuplicate[0 ] == skipTrivialSelect (OriginalBranch.getCondition ())
@@ -386,8 +388,8 @@ static void buildPartialInvariantUnswitchConditionalBranch(
386388 IRB.CreateCondBr (Cond, Direction ? &UnswitchedSucc : &NormalSucc,
387389 Direction ? &NormalSucc : &UnswitchedSucc, ProfData);
388390 if (!ProfData)
389- setExplicitlyUnknownBranchWeightsIfProfiled (
390- *BR, *BR-> getParent ()-> getParent (), DEBUG_TYPE);
391+ setExplicitlyUnknownBranchWeightsIfProfiled (*BR, *BR-> getFunction (),
392+ DEBUG_TYPE);
391393}
392394
393395// / Rewrite the PHI nodes in an unswitched loop exit basic block.
You can’t perform that action at this time.
0 commit comments