File tree Expand file tree Collapse file tree 3 files changed +13
-2
lines changed Expand file tree Collapse file tree 3 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -257,6 +257,8 @@ namespace llvm {
257
257
// / branches.
258
258
extern char &BranchFolderPassID;
259
259
260
+ MachineFunctionPass *createBranchFolderPass (bool EnableTailMerge);
261
+
260
262
// / BranchRelaxation - This pass replaces branches that need to jump further
261
263
// / than is supported by a branch instruction.
262
264
extern char &BranchRelaxationPassID;
Original file line number Diff line number Diff line change @@ -90,10 +90,13 @@ namespace {
90
90
91
91
// / BranchFolderPass - Wrap branch folder in a machine function pass.
92
92
class BranchFolderLegacy : public MachineFunctionPass {
93
+ bool EnableTailMerge;
94
+
93
95
public:
94
96
static char ID;
95
97
96
- explicit BranchFolderLegacy () : MachineFunctionPass(ID) {}
98
+ explicit BranchFolderLegacy (bool EnableTailMerge = true )
99
+ : MachineFunctionPass(ID), EnableTailMerge(EnableTailMerge) {}
97
100
98
101
bool runOnMachineFunction (MachineFunction &MF) override ;
99
102
@@ -152,7 +155,8 @@ bool BranchFolderLegacy::runOnMachineFunction(MachineFunction &MF) {
152
155
// TailMerge can create jump into if branches that make CFG irreducible for
153
156
// HW that requires structurized CFG.
154
157
bool EnableTailMerge = !MF.getTarget ().requiresStructuredCFG () &&
155
- PassConfig->getEnableTailMerge ();
158
+ PassConfig->getEnableTailMerge () &&
159
+ this ->EnableTailMerge ;
156
160
MBFIWrapper MBBFreqInfo (
157
161
getAnalysis<MachineBlockFrequencyInfoWrapperPass>().getMBFI ());
158
162
BranchFolder Folder (
@@ -2080,3 +2084,7 @@ bool BranchFolder::HoistCommonCodeInSuccs(MachineBasicBlock *MBB) {
2080
2084
++NumHoist;
2081
2085
return true ;
2082
2086
}
2087
+
2088
+ MachineFunctionPass *llvm::createBranchFolderPass (bool EnableTailMerge = true ) {
2089
+ return new BranchFolderLegacy (EnableTailMerge);
2090
+ }
Original file line number Diff line number Diff line change 18
18
#include " RISCVTargetTransformInfo.h"
19
19
#include " TargetInfo/RISCVTargetInfo.h"
20
20
#include " llvm/Analysis/TargetTransformInfo.h"
21
+ #include " llvm/CodeGen/BranchFoldingPass.h"
21
22
#include " llvm/CodeGen/GlobalISel/CSEInfo.h"
22
23
#include " llvm/CodeGen/GlobalISel/IRTranslator.h"
23
24
#include " llvm/CodeGen/GlobalISel/InstructionSelect.h"
You can’t perform that action at this time.
0 commit comments