Skip to content

Commit 9b95974

Browse files
Pass global flag via argument
Signed-off-by: Mikhail R. Gadelha <[email protected]>
1 parent 7d8d9df commit 9b95974

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

llvm/lib/CodeGen/BranchFolding.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,8 @@ bool BranchFolderLegacy::runOnMachineFunction(MachineFunction &MF) {
161161
TargetPassConfig *PassConfig = &getAnalysis<TargetPassConfig>();
162162
// TailMerge can create jump into if branches that make CFG irreducible for
163163
// HW that requires structurized CFG.
164-
bool EnableTailMerge = !MF.getTarget().requiresStructuredCFG() &&
165-
PassConfig->getEnableTailMerge() &&
166-
this->EnableTailMerge;
164+
bool EnableTailMerge =
165+
!MF.getTarget().requiresStructuredCFG() && this->EnableTailMerge;
167166
MBFIWrapper MBBFreqInfo(
168167
getAnalysis<MachineBlockFrequencyInfoWrapperPass>().getMBFI());
169168
BranchFolder Folder(

llvm/lib/CodeGen/TargetPassConfig.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1514,7 +1514,7 @@ void TargetPassConfig::addMachineLateOptimization() {
15141514
addPass(&MachineLateInstrsCleanupID);
15151515

15161516
// Branch folding must be run after regalloc and prolog/epilog insertion.
1517-
addPass(&BranchFolderPassID);
1517+
addPass(createBranchFolderPass(getEnableTailMerge()));
15181518

15191519
// Tail duplication.
15201520
// Note that duplicating tail just increases code size and degrades

0 commit comments

Comments
 (0)