aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/disable-tail-calls.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGen/disable-tail-calls.c')
-rw-r--r--test/CodeGen/disable-tail-calls.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/CodeGen/disable-tail-calls.c b/test/CodeGen/disable-tail-calls.c
new file mode 100644
index 000000000000..b06610022659
--- /dev/null
+++ b/test/CodeGen/disable-tail-calls.c
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9.0 -emit-llvm -O1 -mdisable-tail-calls -o - < %s | FileCheck %s
+
+typedef struct List {
+ struct List *next;
+ int data;
+} List;
+
+// CHECK-LABEL: define %struct.List* @find
+List *find(List *head, int data) {
+ if (!head)
+ return 0;
+ if (head->data == data)
+ return head;
+ // CHECK: call %struct.List* @find
+ return find(head->next, data);
+}