Disable Mips' delay slot filler when optimization level is O0.
authorAkira Hatanaka <ahatanaka@mips.com>
Fri, 24 Aug 2012 20:40:15 +0000 (20:40 +0000)
committerAkira Hatanaka <ahatanaka@mips.com>
Fri, 24 Aug 2012 20:40:15 +0000 (20:40 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162589 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Mips/MipsDelaySlotFiller.cpp
test/CodeGen/Mips/brdelayslot.ll

index 8fe3ba6171295e6212790fa26ed979f1282ae372..e3c8ed75cf9198e14e7c469338d2d022523c8fa9 100644 (file)
@@ -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
index d2832da62b96f58d68db6fc9b44c3b7fd9342648..1b2fbc89321f26dac40d597f1dfd101a22af6f0e 100644 (file)
@@ -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