| 1 |
; RUN: opt < %s -passes=tailcallelim -verify-dom-info -S | FileCheck %s |
| 2 |
|
| 3 |
; Test that we don't tail call in a functions that calls returns_twice |
| 4 |
; functions. |
| 5 |
|
| 6 |
declare void @bar() |
| 7 |
|
| 8 |
; CHECK: foo1 |
| 9 |
; CHECK-NOT: tail call void @bar() |
| 10 |
|
| 11 |
define void @foo1(ptr %x) { |
| 12 |
bb: |
| 13 |
%tmp75 = tail call i32 @setjmp(ptr %x) |
| 14 |
call void @bar() |
| 15 |
ret void |
| 16 |
} |
| 17 |
|
| 18 |
declare i32 @setjmp(ptr) returns_twice |
| 19 |
|
| 20 |
; CHECK: foo2 |
| 21 |
; CHECK-NOT: tail call void @bar() |
| 22 |
|
| 23 |
define void @foo2(ptr %x) { |
| 24 |
bb: |
| 25 |
%tmp75 = tail call i32 @zed2(ptr %x) |
| 26 |
call void @bar() |
| 27 |
ret void |
| 28 |
} |
| 29 |
declare i32 @zed2(ptr) returns_twice |