aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2013-07-06 12:58:45 +0000
committerTim Northover <tnorthover@apple.com>2013-07-06 12:58:45 +0000
commite5a81a130f26b0b2651ad6a22e3748703b11cb46 (patch)
tree4069f11e8653340cb3832adc0a9f1ff8ed219a01
parent80646283796b20c6a1b7d8eb69ce6f0478d54383 (diff)
downloadexternal_llvm-e5a81a130f26b0b2651ad6a22e3748703b11cb46.zip
external_llvm-e5a81a130f26b0b2651ad6a22e3748703b11cb46.tar.gz
external_llvm-e5a81a130f26b0b2651ad6a22e3748703b11cb46.tar.bz2
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). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185754 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp4
-rw-r--r--test/CodeGen/ARM/fast-tail-call.ll16
2 files changed, 20 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index fe284f5..23d83e6 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -5357,6 +5357,10 @@ void SelectionDAGBuilder::LowerCallTo(ImmutableCallSite CS, SDValue Callee,
// 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);
}
diff --git a/test/CodeGen/ARM/fast-tail-call.ll b/test/CodeGen/ARM/fast-tail-call.ll
new file mode 100644
index 0000000..9fbdc9d
--- /dev/null
+++ b/test/CodeGen/ARM/fast-tail-call.ll
@@ -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
+}