xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/disable-tail-calls.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -triple x86_64-apple-macosx10.9.0 -emit-llvm -O1 -mdisable-tail-calls -o - < %s | FileCheck %s
2*0a6a1f1dSLionel Sambuc 
3*0a6a1f1dSLionel Sambuc typedef struct List {
4*0a6a1f1dSLionel Sambuc   struct List *next;
5*0a6a1f1dSLionel Sambuc   int data;
6*0a6a1f1dSLionel Sambuc } List;
7*0a6a1f1dSLionel Sambuc 
8*0a6a1f1dSLionel Sambuc // CHECK-LABEL: define %struct.List* @find
find(List * head,int data)9*0a6a1f1dSLionel Sambuc List *find(List *head, int data) {
10*0a6a1f1dSLionel Sambuc   if (!head)
11*0a6a1f1dSLionel Sambuc     return 0;
12*0a6a1f1dSLionel Sambuc   if (head->data == data)
13*0a6a1f1dSLionel Sambuc     return head;
14*0a6a1f1dSLionel Sambuc   // CHECK: call %struct.List* @find
15*0a6a1f1dSLionel Sambuc   return find(head->next, data);
16*0a6a1f1dSLionel Sambuc }
17