1 ; RUN: opt -ipconstprop -S < %s | FileCheck %s
4 ; /---------------------------------------|
5 ; | /----------------------|----|
8 ; void broker(int (*cb0)(int), int (*cb1)(int), int (*cb2)(int), int, int);
10 ; static int cb0(int zero) {
13 ; static int cb1(int unknown) {
16 ; static int cb2(int unknown) {
20 ; static int cb3(int unknown) {
23 ; static int cb4(int unknown) {
30 ; broker(cb0, cb1, cb0, 0, 1);
31 ; broker(cb1, cb2, cb2, 0, 1);
32 ; broker(cb3, cb2, cb3, 0, 1);
33 ; broker(cb4, cb4, cb4, 0, 1);
36 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
38 define internal i32 @cb0(i32 %zero) {
42 ; CHECK-NEXT: ret i32 0
46 define internal i32 @cb1(i32 %unknown) {
48 ; CHECK: ret i32 %unknown
52 define internal i32 @cb2(i32 %unknown) {
54 %call = call i32 @cb0(i32 0)
55 ; CHECK: ret i32 %unknown
59 define internal i32 @cb3(i32 %unknown) {
61 ; CHECK: ret i32 %unknown
65 define internal i32 @cb4(i32 %unknown) {
67 ; CHECK: ret i32 %unknown
73 %call = call i32 @cb0(i32 0)
74 %call1 = call i32 @cb3(i32 1)
75 call void @broker(i32 (i32)* nonnull @cb0, i32 (i32)* nonnull @cb1, i32 (i32)* nonnull @cb0, i32 0, i32 1)
76 call void @broker(i32 (i32)* nonnull @cb1, i32 (i32)* nonnull @cb2, i32 (i32)* nonnull @cb2, i32 0, i32 1)
77 call void @broker(i32 (i32)* nonnull @cb3, i32 (i32)* nonnull @cb2, i32 (i32)* nonnull @cb3, i32 0, i32 1)
78 call void @broker(i32 (i32)* nonnull @cb4, i32 (i32)* nonnull @cb4, i32 (i32)* nonnull @cb4, i32 0, i32 1)
82 declare !callback !3 void @broker(i32 (i32)*, i32 (i32)*, i32 (i32)*, i32, i32)
84 !0 = !{i64 0, i64 3, i1 false}
85 !1 = !{i64 1, i64 4, i1 false}
86 !2 = !{i64 2, i64 3, i1 false}