aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Target/Mips/MipsDelaySlotFiller.cpp4
-rw-r--r--test/CodeGen/Mips/brdelayslot.ll18
2 files changed, 15 insertions, 7 deletions
diff --git a/lib/Target/Mips/MipsDelaySlotFiller.cpp b/lib/Target/Mips/MipsDelaySlotFiller.cpp
index 8fe3ba6171..e3c8ed75cf 100644
--- a/lib/Target/Mips/MipsDelaySlotFiller.cpp
+++ b/lib/Target/Mips/MipsDelaySlotFiller.cpp
@@ -115,7 +115,9 @@ runOnMachineBasicBlock(MachineBasicBlock &MBB) {
InstrIter D;
- if (!DisableDelaySlotFiller && findDelayInstr(MBB, I, D)) {
+ // Delay slot filling is disabled at -O0.
+ if (!DisableDelaySlotFiller && (TM.getOptLevel() != CodeGenOpt::None) &&
+ findDelayInstr(MBB, I, D)) {
MBB.splice(llvm::next(I), &MBB, D);
++UsefulSlots;
} else
diff --git a/test/CodeGen/Mips/brdelayslot.ll b/test/CodeGen/Mips/brdelayslot.ll
index d2832da62b..1b2fbc8932 100644
--- a/test/CodeGen/Mips/brdelayslot.ll
+++ b/test/CodeGen/Mips/brdelayslot.ll
@@ -1,12 +1,18 @@
-; RUN: llc -march=mipsel < %s | FileCheck %s
+; RUN: llc -march=mipsel -O0 < %s | FileCheck %s -check-prefix=None
+; RUN: llc -march=mipsel < %s | FileCheck %s -check-prefix=Default
define void @foo1() nounwind {
entry:
-; CHECK: jalr
-; CHECK-NOT: nop
-; CHECK: jr
-; CHECK-NOT: nop
-; CHECK: .end
+; Default: jalr
+; Default-NOT: nop
+; Default: jr
+; Default-NOT: nop
+; Default: .end
+; None: jalr
+; None: nop
+; None: jr
+; None: nop
+; None: .end
tail call void @foo2(i32 3) nounwind
ret void