1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: -p --function-signature
2 ; RUN: opt -passes=deadargelim -S < %s | FileCheck %s
4 define internal i32 @test_caller(ptr %fptr, i32 %a, i32 %b) {
5 ; CHECK-LABEL: define {{[^@]+}}@test_caller(ptr %fptr, i32 %a, i32 %b) {
6 ; CHECK-NEXT: %r = musttail call i32 @test(ptr %fptr, i32 %a, i32 poison)
7 ; CHECK-NEXT: ret i32 %r
9 %r = musttail call i32 @test(ptr %fptr, i32 %a, i32 %b)
13 define internal i32 @test(ptr %fptr, i32 %a, i32 %b) {
14 ; CHECK-LABEL: define {{[^@]+}}@test(ptr %fptr, i32 %a, i32 %b) {
15 ; CHECK-NEXT: %r = musttail call i32 %fptr(ptr %fptr, i32 %a, i32 0)
16 ; CHECK-NEXT: ret i32 %r
18 %r = musttail call i32 %fptr(ptr %fptr, i32 %a, i32 0)
22 define internal i32 @direct_test() {
23 ; CHECK-LABEL: define {{[^@]+}}@direct_test() {
24 ; CHECK-NEXT: %r = musttail call i32 @foo()
25 ; CHECK-NEXT: ret i32 %r
27 %r = musttail call i32 @foo()
33 define internal i32 @ping(i32 %x) {
34 ; CHECK-LABEL: define {{[^@]+}}@ping(i32 %x) {
35 ; CHECK-NEXT: %r = musttail call i32 @pong(i32 %x)
36 ; CHECK-NEXT: ret i32 %r
38 %r = musttail call i32 @pong(i32 %x)
42 define internal i32 @pong(i32 %x) {
43 ; CHECK-LABEL: define {{[^@]+}}@pong(i32 %x) {
44 ; CHECK-NEXT: %cond = icmp eq i32 %x, 2
45 ; CHECK-NEXT: br i1 %cond, label %yes, label %no
47 ; CHECK-NEXT: %r1 = musttail call i32 @ping(i32 %x)
48 ; CHECK-NEXT: ret i32 %r1
50 ; CHECK-NEXT: %r2 = musttail call i32 @bar(i32 %x)
51 ; CHECK-NEXT: ret i32 %r2
53 %cond = icmp eq i32 %x, 2
54 br i1 %cond, label %yes, label %no
57 %r1 = musttail call i32 @ping(i32 %x)
60 %r2 = musttail call i32 @bar(i32 %x)
64 declare i32 @bar(i32 %x)