[llvm] Revert "[Mips] Did not put fake_use into delay slot" (PR #209937)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 15 19:43:24 PDT 2026


https://github.com/yingopq created https://github.com/llvm/llvm-project/pull/209937

Reverts llvm/llvm-project#201537

>From fcef475c885c374f42e816669a9c8a82ee9d06fe Mon Sep 17 00:00:00 2001
From: yingopq <115543042+yingopq at users.noreply.github.com>
Date: Thu, 16 Jul 2026 10:43:09 +0800
Subject: [PATCH] Revert "[Mips] Did not put fake_use into delay slot
 (#201537)"

This reverts commit 071b86797f62e827bf18e83667b0d1875a5ee446.
---
 llvm/lib/Target/Mips/MipsDelaySlotFiller.cpp | 17 ++++++++---------
 llvm/test/CodeGen/Mips/fake-use.ll           | 15 ---------------
 2 files changed, 8 insertions(+), 24 deletions(-)
 delete mode 100644 llvm/test/CodeGen/Mips/fake-use.ll

diff --git a/llvm/lib/Target/Mips/MipsDelaySlotFiller.cpp b/llvm/lib/Target/Mips/MipsDelaySlotFiller.cpp
index 7d7dac22520ea..bcfaa7cd2ed2d 100644
--- a/llvm/lib/Target/Mips/MipsDelaySlotFiller.cpp
+++ b/llvm/lib/Target/Mips/MipsDelaySlotFiller.cpp
@@ -854,17 +854,10 @@ bool MipsDelaySlotFiller::searchRange(MachineBasicBlock &MBB, IterTy Begin,
     IterTy CurrI = I;
     ++I;
     LLVM_DEBUG(dbgs() << DEBUG_TYPE ": checking instruction: "; CurrI->dump());
-
-    if (terminateSearch(*CurrI)) {
-      LLVM_DEBUG(dbgs() << DEBUG_TYPE ": should terminate search: ";
-                 CurrI->dump());
-      break;
-    }
-    // Skip debug and pseudo instructions.
+    // Skip debug value.
     // Instruction TargetOpcode::JUMP_TABLE_DEBUG_INFO is only used to note
     // jump table debug info.
-    if (CurrI->isDebugInstr() || CurrI->isJumpTableDebugInfo() ||
-        CurrI->isMetaInstruction()) {
+    if (CurrI->isDebugInstr() || CurrI->isJumpTableDebugInfo()) {
       LLVM_DEBUG(dbgs() << DEBUG_TYPE ": ignoring debug instruction: ";
                  CurrI->dump());
       continue;
@@ -878,6 +871,12 @@ bool MipsDelaySlotFiller::searchRange(MachineBasicBlock &MBB, IterTy Begin,
       continue;
     }
 
+    if (terminateSearch(*CurrI)) {
+      LLVM_DEBUG(dbgs() << DEBUG_TYPE ": should terminate search: ";
+                 CurrI->dump());
+      break;
+    }
+
     assert((!CurrI->isCall() && !CurrI->isReturn() && !CurrI->isBranch()) &&
            "Cannot put calls, returns or branches in delay slot.");
 
diff --git a/llvm/test/CodeGen/Mips/fake-use.ll b/llvm/test/CodeGen/Mips/fake-use.ll
deleted file mode 100644
index c8c7f83624314..0000000000000
--- a/llvm/test/CodeGen/Mips/fake-use.ll
+++ /dev/null
@@ -1,15 +0,0 @@
-; RUN: llc -verify-machineinstrs -mtriple=mipsel-linux-gnu -mcpu=mips32r2 %s -o - | FileCheck %s
-
-define void @fake_use(ptr %aaaa) {
-; CHECK-LABEL: fake_use:
-; CHECK:       # %bb.0:    # %entry
-; CHECK-NEXT:              # fake_use: $a0 
-; CHECK-NEXT:    jr $ra 
-; CHECK-NEXT:    nop
-entry:
-  notail call void (...) @llvm.fake.use(ptr %aaaa)
-  ret void
-}
-
-declare void @llvm.fake.use(...)
-



More information about the llvm-commits mailing list