[llvm] [SPARC] Prevent RESTORE from consuming an indirect call's target (PR #228198)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 5 15:47:50 PDT 2026


================
@@ -489,6 +496,20 @@ static bool combineRestoreSETHIi(MachineBasicBlock::iterator RestoreMI,
   return true;
 }
 
+// Returns true if Reg is a fixed operand of the terminator of MBB.
+// Variadic operands are call arguments and are not checked.
+static bool terminatorReadsReg(MachineBasicBlock &MBB, Register Reg) {
+  MachineBasicBlock::iterator Term = MBB.getFirstTerminator();
+  if (Term == MBB.end())
+    return false;
+  for (unsigned I = 0, E = Term->getDesc().getNumOperands(); I != E; ++I) {
----------------
arsenm wrote:

This is reinventing MachineInstr::readsRegister?

https://github.com/llvm/llvm-project/pull/228198


More information about the llvm-commits mailing list