blob: 87cb9dd427b47187f2933a8a159c967f82b5dd77 [file] [log] [blame]
Nick Lewycky10b606f2009-11-07 07:10:01 +00001; RUN: opt %s -tailcallelim -S | FileCheck %s
Nick Lewycky5031fbd2009-11-07 07:42:38 +00002; XFAIL: *
Nick Lewycky10b606f2009-11-07 07:10:01 +00003
4declare void @use(i8* nocapture, i8* nocapture)
5
6define i8* @foo(i8* nocapture %A, i1 %cond) {
7; CHECK: tailrecurse:
8; CHECK: %A.tr = phi i8* [ %A, %0 ], [ %B, %cond_true ]
9; CHECK: %cond.tr = phi i1 [ %cond, %0 ], [ false, %cond_true ]
10 %B = alloca i8
11; CHECK: %B = alloca i8
12 br i1 %cond, label %cond_true, label %cond_false
13; CHECK: br i1 %cond.tr, label %cond_true, label %cond_false
14cond_true:
15; CHECK: cond_true:
16; CHECK: br label %tailrecurse
17 call i8* @foo(i8* %B, i1 false)
18 ret i8* null
19cond_false:
20; CHECK: cond_false
21 call void @use(i8* %A, i8* %B)
22; CHECK: tail call void @use(i8* %A.tr, i8* %B)
23 ret i8* null
24; CHECK: ret i8* null
25}