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