summaryrefslogtreecommitdiff
path: root/test/CodeGen/disable-tail-calls.c
blob: b06610022659d93349c5526b301be4af0344561d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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);
}