| 1 |
; RUN: opt < %s -passes=tailcallelim -verify-dom-info -S | FileCheck %s |
| 2 |
|
| 3 |
define i32 @f_1(i32 %x) { |
| 4 |
; CHECK-LABEL: @f_1( |
| 5 |
wentry: |
| 6 |
%cond = icmp ugt i32 %x, 0 |
| 7 |
br i1 %cond, label %return, label %body |
| 8 |
|
| 9 |
body: |
| 10 |
; CHECK: body: |
| 11 |
; CHECK: call i32 @f_1(i32 %y) [ "deopt"() ] |
| 12 |
%y = add i32 %x, 1 |
| 13 |
%tmp = call i32 @f_1(i32 %y) [ "deopt"() ] |
| 14 |
ret i32 0 |
| 15 |
|
| 16 |
return: |
| 17 |
ret i32 1 |
| 18 |
} |
| 19 |
|
| 20 |
define i32 @f_2(i32 %x) { |
| 21 |
; CHECK-LABEL: @f_2 |
| 22 |
|
| 23 |
entry: |
| 24 |
%cond = icmp ugt i32 %x, 0 |
| 25 |
br i1 %cond, label %return, label %body |
| 26 |
|
| 27 |
body: |
| 28 |
; CHECK: body: |
| 29 |
; CHECK: call i32 @f_2(i32 %y) [ "unknown"() ] |
| 30 |
%y = add i32 %x, 1 |
| 31 |
%tmp = call i32 @f_2(i32 %y) [ "unknown"() ] |
| 32 |
ret i32 0 |
| 33 |
|
| 34 |
return: |
| 35 |
ret i32 1 |
| 36 |
} |
| 37 |
|
| 38 |
declare void @func() |
| 39 |
|
| 40 |
define void @f_3(i1 %B) personality i8 42 { |
| 41 |
; CHECK-LABEL: @f_3( |
| 42 |
entry: |
| 43 |
invoke void @func() |
| 44 |
to label %exit unwind label %merge |
| 45 |
merge: |
| 46 |
%cs1 = catchswitch within none [label %catch] unwind to caller |
| 47 |
|
| 48 |
catch: |
| 49 |
; CHECK: catch: |
| 50 |
; CHECK: call void @f_3(i1 %B) [ "funclet"(token %cp) ] |
| 51 |
%cp = catchpad within %cs1 [] |
| 52 |
call void @f_3(i1 %B) [ "funclet"(token %cp) ] |
| 53 |
ret void |
| 54 |
|
| 55 |
exit: |
| 56 |
ret void |
| 57 |
} |
| 58 |
|
| 59 |
; CHECK-LABEL: @test_clang_arc_attachedcall( |
| 60 |
; CHECK: tail call ptr @getObj( |
| 61 |
|
| 62 |
declare ptr @getObj() |
| 63 |
|
| 64 |
define ptr @test_clang_arc_attachedcall() { |
| 65 |
%r = call ptr @getObj() [ "clang.arc.attachedcall"(ptr @llvm.objc.retainAutoreleasedReturnValue) ] |
| 66 |
ret ptr %r |
| 67 |
} |
| 68 |
|
| 69 |
declare ptr @llvm.objc.retainAutoreleasedReturnValue(ptr) |