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 {
257257 // / branches.
258258 extern char &BranchFolderPassID;
259259
260+ MachineFunctionPass *createBranchFolderPass (bool EnableTailMerge);
261+
260262 // / BranchRelaxation - This pass replaces branches that need to jump further
261263 // / than is supported by a branch instruction.
262264 extern char &BranchRelaxationPassID;
Original file line number Diff line number Diff line change @@ -90,10 +90,13 @@ namespace {
9090
9191 // / BranchFolderPass - Wrap branch folder in a machine function pass.
9292class BranchFolderLegacy : public MachineFunctionPass {
93+ bool EnableTailMerge;
94+
9395public:
9496 static char ID;
9597
96- explicit BranchFolderLegacy () : MachineFunctionPass(ID) {}
98+ explicit BranchFolderLegacy (bool EnableTailMerge = true )
99+ : MachineFunctionPass(ID), EnableTailMerge(EnableTailMerge) {}
97100
98101 bool runOnMachineFunction (MachineFunction &MF) override ;
99102
@@ -152,7 +155,8 @@ bool BranchFolderLegacy::runOnMachineFunction(MachineFunction &MF) {
152155 // TailMerge can create jump into if branches that make CFG irreducible for
153156 // HW that requires structurized CFG.
154157 bool EnableTailMerge = !MF.getTarget ().requiresStructuredCFG () &&
155- PassConfig->getEnableTailMerge ();
158+ PassConfig->getEnableTailMerge () &&
159+ this ->EnableTailMerge ;
156160 MBFIWrapper MBBFreqInfo (
157161 getAnalysis<MachineBlockFrequencyInfoWrapperPass>().getMBFI ());
158162 BranchFolder Folder (
@@ -2080,3 +2084,7 @@ bool BranchFolder::HoistCommonCodeInSuccs(MachineBasicBlock *MBB) {
20802084 ++NumHoist;
20812085 return true ;
20822086}
2087+
2088+ MachineFunctionPass *llvm::createBranchFolderPass (bool EnableTailMerge = true ) {
2089+ return new BranchFolderLegacy (EnableTailMerge);
2090+ }
Original file line number Diff line number Diff line change 1818#include " RISCVTargetTransformInfo.h"
1919#include " TargetInfo/RISCVTargetInfo.h"
2020#include " llvm/Analysis/TargetTransformInfo.h"
21+ #include " llvm/CodeGen/BranchFoldingPass.h"
2122#include " llvm/CodeGen/GlobalISel/CSEInfo.h"
2223#include " llvm/CodeGen/GlobalISel/IRTranslator.h"
2324#include " llvm/CodeGen/GlobalISel/InstructionSelect.h"
You can’t perform that action at this time.
0 commit comments