[llvm] [AMDGPU] Remove blocks that only branch to other blocks (PR #184908)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 10 06:46:36 PDT 2026
================
@@ -763,6 +765,72 @@ MachineInstrBuilder SIPreEmitPeephole::createUnpackedMI(MachineInstr &I,
return NewMI;
}
+// Remove blocks that only have an unconditional branch.
+bool SIPreEmitPeephole::removeUnconditionalBranchBlocks(MachineFunction &MF) {
+ SIMachineFunctionInfo *FuncInfo = MF.getInfo<SIMachineFunctionInfo>();
+ SmallVector<MachineBasicBlock *, 2> ToRemoveMBB;
+ bool Changed = false;
+
+ for (MachineBasicBlock &MBB : MF) {
+ MachineBasicBlock *Succ = *MBB.succ_begin();
+ // Cannot remove entry block
----------------
LU-JOHN wrote:
This would require blocks to be re-ordered.
https://github.com/llvm/llvm-project/pull/184908
More information about the llvm-commits
mailing list