[llvm] [Mips][BranchFolding] Enable safe tail merging (PR #225382)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 22 05:41:03 PDT 2026
================
@@ -57,6 +59,23 @@ const MipsInstrInfo *MipsInstrInfo::create(MipsSubtarget &STI) {
return createMipsSEInstrInfo(STI);
}
+bool MipsInstrInfo::isLegalToSplitMBBAt(
+ MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI) const {
+ // Keep tail merging disabled for MIPS16, whose far branches clobber $ra.
+ if (Subtarget.inMips16Mode())
+ return false;
+
+ // Long branch expansion clobbers $at. Do not let tail merging introduce a
----------------
arsenm wrote:
The pass generically needs to respect liveness, this shouldn't require a target hook?
https://github.com/llvm/llvm-project/pull/225382
More information about the llvm-commits
mailing list