[llvm] r185754 - Stop putting operations after a tail call.

Tim Northover tnorthover at apple.com
Sat Jul 6 05:58:45 PDT 2013


Author: tnorthover
Date: Sat Jul  6 07:58:45 2013
New Revision: 185754

URL: http://llvm.org/viewvc/llvm-project?rev=185754&view=rev
Log:
Stop putting operations after a tail call.

This prevents the emission of DAG-generated vreg definitions after a
tail call be dropping them entirely (on the grounds that nothing could
use them anyway, and they interfere with O0 CodeGen).

Added:
    llvm/trunk/test/CodeGen/ARM/fast-tail-call.ll
Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=185754&r1=185753&r2=185754&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Sat Jul  6 07:58:45 2013
@@ -5357,6 +5357,10 @@ void SelectionDAGBuilder::LowerCallTo(Im
     // As a special case, a null chain means that a tail call has been emitted and
     // the DAG root is already updated.
     HasTailCall = true;
+
+    // Since there's no actual continuation from this block, nothing can be
+    // relying on us setting vregs for them.
+    PendingExports.clear();
   } else {
     DAG.setRoot(Result.second);
   }

Added: llvm/trunk/test/CodeGen/ARM/fast-tail-call.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/fast-tail-call.ll?rev=185754&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/fast-tail-call.ll (added)
+++ llvm/trunk/test/CodeGen/ARM/fast-tail-call.ll Sat Jul  6 07:58:45 2013
@@ -0,0 +1,16 @@
+; RUN: llc -mtriple=thumbv7-linux-gnueabi -O0 -arm-tail-calls < %s | FileCheck %s
+
+; Primarily a non-crash test: Thumbv7 Linux does not have FastISel support,
+; which led (via a convoluted route) to DAG nodes after a TC_RETURN that
+; couldn't possibly work.
+
+declare i8* @g(i8*)
+
+define i8* @f(i8* %a) {
+entry:
+  %0 = tail call i8* @g(i8* %a)
+  ret i8* %0
+; CHECK: b g
+; CHECK-NOT: ldr
+; CHECK-NOT: str
+}





More information about the llvm-commits mailing list