Prevent IMPLICIT_DEF/KILL to become a delay filler instruction in SPARC backend.
authorVenkatraman Govindaraju <venkatra@cs.wisc.edu>
Sat, 12 Feb 2011 19:02:33 +0000 (19:02 +0000)
committerVenkatraman Govindaraju <venkatra@cs.wisc.edu>
Sat, 12 Feb 2011 19:02:33 +0000 (19:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125444 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Sparc/DelaySlotFiller.cpp
test/CodeGen/SPARC/2011-01-19-DelaySlot.ll

index b0d669b860f1ed3fccc21252b7c5ca4fdaf5cc6e..ee292758d186166c0979247c364552c85f6a7470 100644 (file)
@@ -182,6 +182,9 @@ bool Filler::delayHasHazard(MachineBasicBlock::iterator candidate,
                             SmallSet<unsigned, 32> &RegUses)
 {
 
+  if (candidate->isImplicitDef() || candidate->isKill())
+    return true;
+
   if (candidate->getDesc().mayLoad()) {
     sawLoad = true;
     if (sawStore)
index d9fc8ea3aa85909ad05033bb11c2dda7e98f2c62..bc27e987a179fd46bab21b3b71b9f7230e9e892e 100644 (file)
@@ -1,4 +1,5 @@
 ;RUN: llc -march=sparc < %s | FileCheck %s
+;RUN: llc -march=sparc -O0 < %s | FileCheck %s -check-prefix=UNOPT
 
 
 define i32 @test(i32 %a) nounwind {
@@ -75,3 +76,15 @@ bb1:                                              ; preds = %entry
 declare i32 @foo(...)
 
 declare i32 @bar(i32)
+
+
+define i32 @test_implicit_def() nounwind {
+entry:
+;UNOPT:       test_implicit_def
+;UNOPT:       call func
+;UNOPT-NEXT:  nop
+  %0 = tail call i32 @func(i32* undef) nounwind
+  ret i32 0
+}
+
+declare i32 @func(i32*)