2013-01-01 13:57:25 +00:00
|
|
|
; RUN: opt -tailcallelim -S < %s | FileCheck %s
|
2012-10-22 18:16:14 +00:00
|
|
|
; XFAIL: *
|
2009-11-07 07:10:01 +00:00
|
|
|
|
|
|
|
declare void @use(i8* nocapture, i8* nocapture)
|
|
|
|
|
2012-10-22 18:16:14 +00:00
|
|
|
define i8* @foo(i8* nocapture %A, i1 %cond) {
|
2009-11-07 07:10:01 +00:00
|
|
|
; CHECK: tailrecurse:
|
|
|
|
; CHECK: %A.tr = phi i8* [ %A, %0 ], [ %B, %cond_true ]
|
|
|
|
; CHECK: %cond.tr = phi i1 [ %cond, %0 ], [ false, %cond_true ]
|
|
|
|
%B = alloca i8
|
|
|
|
; CHECK: %B = alloca i8
|
|
|
|
br i1 %cond, label %cond_true, label %cond_false
|
|
|
|
; CHECK: br i1 %cond.tr, label %cond_true, label %cond_false
|
|
|
|
cond_true:
|
|
|
|
; CHECK: cond_true:
|
|
|
|
; CHECK: br label %tailrecurse
|
2012-10-22 18:16:14 +00:00
|
|
|
call i8* @foo(i8* %B, i1 false)
|
2009-11-07 07:10:01 +00:00
|
|
|
ret i8* null
|
|
|
|
cond_false:
|
|
|
|
; CHECK: cond_false
|
|
|
|
call void @use(i8* %A, i8* %B)
|
2012-10-22 18:16:14 +00:00
|
|
|
; CHECK: tail call void @use(i8* %A.tr, i8* %B)
|
2009-11-07 07:10:01 +00:00
|
|
|
ret i8* null
|
|
|
|
; CHECK: ret i8* null
|
|
|
|
}
|