1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-attributes
2 ; RUN: opt -passes=ipsccp -S %s | FileCheck %s
5 ; /---------------------------------------|
6 ; | /----------------------|----|
9 ; void broker(int (*cb0)(int), int (*cb1)(int), int (*cb2)(int), int, int);
11 ; static int cb0(int zero) {
14 ; static int cb1(int unknown) {
17 ; static int cb2(int unknown) {
21 ; static int cb3(int unknown) {
24 ; static int cb4(int unknown) {
31 ; broker(cb0, cb1, cb0, 0, 1);
32 ; broker(cb1, cb2, cb2, 0, 1);
33 ; broker(cb3, cb2, cb3, 0, 1);
34 ; broker(cb4, cb4, cb4, 0, 1);
37 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
39 define internal i32 @cb0(i32 %zero) {
42 ; CHECK-NEXT: ret i32 [[ZERO:%.*]]
48 define internal i32 @cb1(i32 %unknown) {
51 ; CHECK-NEXT: ret i32 [[UNKNOWN:%.*]]
57 define internal i32 @cb2(i32 %unknown) {
60 ; CHECK-NEXT: [[CALL:%.*]] = call i32 @cb0(i32 0)
61 ; CHECK-NEXT: ret i32 [[UNKNOWN:%.*]]
64 %call = call i32 @cb0(i32 0)
68 define internal i32 @cb3(i32 %unknown) {
71 ; CHECK-NEXT: ret i32 [[UNKNOWN:%.*]]
77 define internal i32 @cb4(i32 %unknown) {
80 ; CHECK-NEXT: ret i32 [[UNKNOWN:%.*]]
89 ; CHECK-NEXT: [[CALL:%.*]] = call i32 @cb0(i32 0)
90 ; CHECK-NEXT: [[CALL1:%.*]] = call i32 @cb3(i32 1)
91 ; CHECK-NEXT: call void @broker(ptr nonnull @cb0, ptr nonnull @cb1, ptr nonnull @cb0, i32 0, i32 1)
92 ; CHECK-NEXT: call void @broker(ptr nonnull @cb1, ptr nonnull @cb2, ptr nonnull @cb2, i32 0, i32 1)
93 ; CHECK-NEXT: call void @broker(ptr nonnull @cb3, ptr nonnull @cb2, ptr nonnull @cb3, i32 0, i32 1)
94 ; CHECK-NEXT: call void @broker(ptr nonnull @cb4, ptr nonnull @cb4, ptr nonnull @cb4, i32 0, i32 1)
95 ; CHECK-NEXT: ret void
98 %call = call i32 @cb0(i32 0)
99 %call1 = call i32 @cb3(i32 1)
100 call void @broker(ptr nonnull @cb0, ptr nonnull @cb1, ptr nonnull @cb0, i32 0, i32 1)
101 call void @broker(ptr nonnull @cb1, ptr nonnull @cb2, ptr nonnull @cb2, i32 0, i32 1)
102 call void @broker(ptr nonnull @cb3, ptr nonnull @cb2, ptr nonnull @cb3, i32 0, i32 1)
103 call void @broker(ptr nonnull @cb4, ptr nonnull @cb4, ptr nonnull @cb4, i32 0, i32 1)
107 declare !callback !3 void @broker(ptr, ptr, ptr, i32, i32)
109 !0 = !{i64 0, i64 3, i1 false}
110 !1 = !{i64 1, i64 4, i1 false}
111 !2 = !{i64 2, i64 3, i1 false}