[llvm] [CodeGen][NPM] Update BranchFolderLegacy make tail merge configurable via flag (PR #135277)
Mikhail R. Gadelha via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 11 15:08:25 PDT 2025
================
@@ -152,7 +162,8 @@ bool BranchFolderLegacy::runOnMachineFunction(MachineFunction &MF) {
// TailMerge can create jump into if branches that make CFG irreducible for
// HW that requires structurized CFG.
bool EnableTailMerge = !MF.getTarget().requiresStructuredCFG() &&
- PassConfig->getEnableTailMerge();
+ PassConfig->getEnableTailMerge() &&
----------------
mikhailramalho wrote:
I was checking the other passes that are also disabled, and unfortunately, I couldn't find any pass that both takes an argument and access a flag via PassConfig. The closest were:
- `MachineCopyPropagation`: takes a boolean to create the pass (`UseCopyInstr`), has the `createMachineCopyPropagationPass` function but doesn't access the PassConfig.
- `MachineSinking`: doesn't take a boolean to create the pass (`EnableSinkAndFold`), doesn't have a `createMachineSinkingPass` function, and accesses the PassConfig option to enable sink and hold only on the `runOnMachineFunction` method.
The MCP pass should be close to what I want to do with this pass: it's added via its ID on TargetPassConfig and targets add them later on using the `createMachineCopyPropagationPass` function, changing the boolean flag.
The goal of this PR is to add this pass disabling tail merge on riscv only.
https://github.com/llvm/llvm-project/pull/135277
More information about the llvm-commits
mailing list