Skip to content

Commit 756e1a5

Browse files
Moved requiresStructuredCFG check to pass creation
Signed-off-by: Mikhail R. Gadelha <[email protected]>
1 parent 1293477 commit 756e1a5

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

llvm/lib/CodeGen/BranchFolding.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,6 @@ INITIALIZE_PASS(BranchFolderLegacy, DEBUG_TYPE, "Control Flow Optimizer", false,
124124
PreservedAnalyses BranchFolderPass::run(MachineFunction &MF,
125125
MachineFunctionAnalysisManager &MFAM) {
126126
MFPropsModifier _(*this, MF);
127-
bool EnableTailMerge =
128-
!MF.getTarget().requiresStructuredCFG() && this->EnableTailMerge;
129-
130127
auto &MBPI = MFAM.getResult<MachineBranchProbabilityAnalysis>(MF);
131128
auto *PSI = MFAM.getResult<ModuleAnalysisManagerMachineFunctionProxy>(MF)
132129
.getCachedResult<ProfileSummaryAnalysis>(

llvm/lib/CodeGen/TargetPassConfig.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1518,7 +1518,8 @@ void TargetPassConfig::addMachineLateOptimization() {
15181518
addPass(&MachineLateInstrsCleanupID);
15191519

15201520
// Branch folding must be run after regalloc and prolog/epilog insertion.
1521-
addPass(createBranchFolderPass(getEnableTailMerge()));
1521+
addPass(createBranchFolderPass(!TM->requiresStructuredCFG() &&
1522+
getEnableTailMerge()));
15221523

15231524
// Tail duplication.
15241525
// Note that duplicating tail just increases code size and degrades

0 commit comments

Comments
 (0)