1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals 2; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM 3; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=2 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM 4; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM 5; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM 6; 7; 8; /---------------------------------------| 9; | /----------------------|----| 10; | | /-----| | 11; V V V | | 12; void broker(int (*cb0)(int), int (*cb1)(int), int (*cb2)(int), int, int); 13; 14; static int cb0(int zero) { 15; return zero; 16; } 17; static int cb1(int unknown) { 18; return unknown; 19; } 20; static int cb2(int unknown) { 21; cb0(0); 22; return unknown; 23; } 24; static int cb3(int unknown) { 25; return unknown; 26; } 27; static int cb4(int unknown) { 28; return unknown; 29; } 30; 31; void foo() { 32; cb0(0); 33; cb3(1); 34; broker(cb0, cb1, cb0, 0, 1); 35; broker(cb1, cb2, cb2, 0, 1); 36; broker(cb3, cb2, cb3, 0, 1); 37; broker(cb4, cb4, cb4, 0, 1); 38; } 39; 40target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 41 42define internal i32 @cb0(i32 %zero) { 43; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 44; CHECK-LABEL: define {{[^@]+}}@cb0 45; CHECK-SAME: (i32 [[ZERO:%.*]]) #[[ATTR0:[0-9]+]] { 46; CHECK-NEXT: entry: 47; CHECK-NEXT: ret i32 0 48; 49entry: 50 ret i32 %zero 51} 52 53define internal i32 @cb1(i32 %unknown) { 54; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 55; CHECK-LABEL: define {{[^@]+}}@cb1 56; CHECK-SAME: (i32 noundef [[UNKNOWN:%.*]]) #[[ATTR0]] { 57; CHECK-NEXT: entry: 58; CHECK-NEXT: ret i32 [[UNKNOWN]] 59; 60entry: 61 ret i32 %unknown 62} 63 64define internal i32 @cb2(i32 %unknown) { 65; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 66; IS__TUNIT____-LABEL: define {{[^@]+}}@cb2 67; IS__TUNIT____-SAME: (i32 noundef [[UNKNOWN:%.*]]) #[[ATTR0]] { 68; IS__TUNIT____-NEXT: entry: 69; IS__TUNIT____-NEXT: ret i32 [[UNKNOWN]] 70; 71; IS__CGSCC____: Function Attrs: nofree nosync nounwind readnone willreturn 72; IS__CGSCC____-LABEL: define {{[^@]+}}@cb2 73; IS__CGSCC____-SAME: (i32 noundef [[UNKNOWN:%.*]]) #[[ATTR1:[0-9]+]] { 74; IS__CGSCC____-NEXT: entry: 75; IS__CGSCC____-NEXT: ret i32 [[UNKNOWN]] 76; 77entry: 78 %call = call i32 @cb0(i32 0) 79 ret i32 %unknown 80} 81 82define internal i32 @cb3(i32 %unknown) { 83; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 84; CHECK-LABEL: define {{[^@]+}}@cb3 85; CHECK-SAME: (i32 noundef [[UNKNOWN:%.*]]) #[[ATTR0]] { 86; CHECK-NEXT: entry: 87; CHECK-NEXT: ret i32 [[UNKNOWN]] 88; 89entry: 90 ret i32 %unknown 91} 92 93define internal i32 @cb4(i32 %unknown) { 94; CHECK: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 95; CHECK-LABEL: define {{[^@]+}}@cb4 96; CHECK-SAME: (i32 noundef [[UNKNOWN:%.*]]) #[[ATTR0]] { 97; CHECK-NEXT: entry: 98; CHECK-NEXT: ret i32 [[UNKNOWN]] 99; 100entry: 101 ret i32 %unknown 102} 103 104define void @foo() { 105; CHECK-LABEL: define {{[^@]+}}@foo() { 106; CHECK-NEXT: entry: 107; CHECK-NEXT: call void @broker(i32 (i32)* noundef nonnull @cb0, i32 (i32)* noundef nonnull @cb1, i32 (i32)* noundef nonnull @cb0, i32 noundef 0, i32 noundef 1) 108; CHECK-NEXT: call void @broker(i32 (i32)* noundef nonnull @cb1, i32 (i32)* noundef nonnull @cb2, i32 (i32)* noundef nonnull @cb2, i32 noundef 0, i32 noundef 1) 109; CHECK-NEXT: call void @broker(i32 (i32)* noundef nonnull @cb3, i32 (i32)* noundef nonnull @cb2, i32 (i32)* noundef nonnull @cb3, i32 noundef 0, i32 noundef 1) 110; CHECK-NEXT: call void @broker(i32 (i32)* noundef nonnull @cb4, i32 (i32)* noundef nonnull @cb4, i32 (i32)* noundef nonnull @cb4, i32 noundef 0, i32 noundef 1) 111; CHECK-NEXT: ret void 112; 113entry: 114 %call = call i32 @cb0(i32 0) 115 %call1 = call i32 @cb3(i32 1) 116 call void @broker(i32 (i32)* nonnull @cb0, i32 (i32)* nonnull @cb1, i32 (i32)* nonnull @cb0, i32 0, i32 1) 117 call void @broker(i32 (i32)* nonnull @cb1, i32 (i32)* nonnull @cb2, i32 (i32)* nonnull @cb2, i32 0, i32 1) 118 call void @broker(i32 (i32)* nonnull @cb3, i32 (i32)* nonnull @cb2, i32 (i32)* nonnull @cb3, i32 0, i32 1) 119 call void @broker(i32 (i32)* nonnull @cb4, i32 (i32)* nonnull @cb4, i32 (i32)* nonnull @cb4, i32 0, i32 1) 120 ret void 121} 122 123declare !callback !3 void @broker(i32 (i32)*, i32 (i32)*, i32 (i32)*, i32, i32) 124 125!0 = !{i64 0, i64 3, i1 false} 126!1 = !{i64 1, i64 4, i1 false} 127!2 = !{i64 2, i64 3, i1 false} 128!3 = !{!0, !2, !1} 129;. 130; IS__TUNIT____: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn } 131;. 132; IS__CGSCC____: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn } 133; IS__CGSCC____: attributes #[[ATTR1]] = { nofree nosync nounwind readnone willreturn } 134;. 135; CHECK: [[META0:![0-9]+]] = !{!1, !2, !3} 136; CHECK: [[META1:![0-9]+]] = !{i64 0, i64 3, i1 false} 137; CHECK: [[META2:![0-9]+]] = !{i64 2, i64 3, i1 false} 138; CHECK: [[META3:![0-9]+]] = !{i64 1, i64 4, i1 false} 139;. 140