Nick Lewycky | 10b606f | 2009-11-07 07:10:01 +0000 | [diff] [blame] | 1 | ; RUN: opt %s -tailcallelim -S | FileCheck %s |
Nick Lewycky | 5031fbd | 2009-11-07 07:42:38 +0000 | [diff] [blame] | 2 | ; XFAIL: * |
Nick Lewycky | 10b606f | 2009-11-07 07:10:01 +0000 | [diff] [blame] | 3 | |
| 4 | declare void @use(i8* nocapture, i8* nocapture) |
| 5 | |
| 6 | define 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 |
| 14 | cond_true: |
| 15 | ; CHECK: cond_true: |
| 16 | ; CHECK: br label %tailrecurse |
| 17 | call i8* @foo(i8* %B, i1 false) |
| 18 | ret i8* null |
| 19 | cond_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 | } |