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=3 -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=3 -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; Mostly check we do not crash on these uses 8 9define internal void @internal(void (i8*)* %fp) { 10; 11; 12; IS__TUNIT____-LABEL: define {{[^@]+}}@internal 13; IS__TUNIT____-SAME: (void (i8*)* nonnull [[FP:%.*]]) { 14; IS__TUNIT____-NEXT: entry: 15; IS__TUNIT____-NEXT: [[A:%.*]] = alloca i32, align 4 16; IS__TUNIT____-NEXT: call void @foo(i32* noalias nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[A]]) #[[ATTR1:[0-9]+]] 17; IS__TUNIT____-NEXT: call void [[FP]](i8* bitcast (void (i32*)* @foo to i8*)) 18; IS__TUNIT____-NEXT: call void @callback1(void (i32*)* noundef nonnull @foo) 19; IS__TUNIT____-NEXT: call void @callback2(void (i8*)* noundef bitcast (void (i32*)* @foo to void (i8*)*)) 20; IS__TUNIT____-NEXT: call void @callback2(void (i8*)* nonnull [[FP]]) 21; IS__TUNIT____-NEXT: [[TMP1:%.*]] = bitcast i32* [[A]] to i8* 22; IS__TUNIT____-NEXT: call void [[FP]](i8* [[TMP1]]) 23; IS__TUNIT____-NEXT: ret void 24; 25; IS__CGSCC____-LABEL: define {{[^@]+}}@internal 26; IS__CGSCC____-SAME: (void (i8*)* noundef nonnull [[FP:%.*]]) { 27; IS__CGSCC____-NEXT: entry: 28; IS__CGSCC____-NEXT: [[A:%.*]] = alloca i32, align 4 29; IS__CGSCC____-NEXT: [[TMP:%.*]] = bitcast i32* [[A]] to i8* 30; IS__CGSCC____-NEXT: call void @foo(i32* noalias nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[A]]) #[[ATTR1:[0-9]+]] 31; IS__CGSCC____-NEXT: call void [[FP]](i8* bitcast (void (i32*)* @foo to i8*)) 32; IS__CGSCC____-NEXT: call void @callback1(void (i32*)* noundef nonnull @foo) 33; IS__CGSCC____-NEXT: call void @callback2(void (i8*)* noundef bitcast (void (i32*)* @foo to void (i8*)*)) 34; IS__CGSCC____-NEXT: call void @callback2(void (i8*)* noundef nonnull [[FP]]) 35; IS__CGSCC____-NEXT: [[TMP1:%.*]] = bitcast i32* [[A]] to i8* 36; IS__CGSCC____-NEXT: call void [[FP]](i8* [[TMP1]]) 37; IS__CGSCC____-NEXT: ret void 38; 39entry: 40 %a = alloca i32, align 4 41 %tmp = bitcast i32* %a to i8* 42 call void @foo(i32* nonnull %a) 43 call void %fp(i8* bitcast (void (i32*)* @foo to i8*)) 44 call void @callback1(void (i32*)* nonnull @foo) 45 call void @callback2(void (i8*)* bitcast (void (i32*)* @foo to void (i8*)*)) 46 call void @callback2(void (i8*)* %fp) 47 %tmp1 = bitcast i32* %a to i8* 48 call void %fp(i8* %tmp1) 49 ret void 50} 51 52define void @external(void (i8*)* %fp) { 53; 54; 55; IS__TUNIT____-LABEL: define {{[^@]+}}@external 56; IS__TUNIT____-SAME: (void (i8*)* [[FP:%.*]]) { 57; IS__TUNIT____-NEXT: entry: 58; IS__TUNIT____-NEXT: [[A:%.*]] = alloca i32, align 4 59; IS__TUNIT____-NEXT: call void @foo(i32* noalias nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[A]]) #[[ATTR1]] 60; IS__TUNIT____-NEXT: call void @callback1(void (i32*)* noundef nonnull @foo) 61; IS__TUNIT____-NEXT: call void @callback2(void (i8*)* noundef bitcast (void (i32*)* @foo to void (i8*)*)) 62; IS__TUNIT____-NEXT: call void @callback2(void (i8*)* [[FP]]) 63; IS__TUNIT____-NEXT: call void [[FP]](i8* bitcast (void (i32*)* @foo to i8*)) 64; IS__TUNIT____-NEXT: [[TMP1:%.*]] = bitcast i32* [[A]] to i8* 65; IS__TUNIT____-NEXT: call void [[FP]](i8* [[TMP1]]) 66; IS__TUNIT____-NEXT: call void @internal(void (i8*)* nonnull [[FP]]) 67; IS__TUNIT____-NEXT: ret void 68; 69; IS__CGSCC____-LABEL: define {{[^@]+}}@external 70; IS__CGSCC____-SAME: (void (i8*)* [[FP:%.*]]) { 71; IS__CGSCC____-NEXT: entry: 72; IS__CGSCC____-NEXT: [[A:%.*]] = alloca i32, align 4 73; IS__CGSCC____-NEXT: call void @foo(i32* noalias nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[A]]) #[[ATTR1]] 74; IS__CGSCC____-NEXT: call void @callback1(void (i32*)* noundef nonnull @foo) 75; IS__CGSCC____-NEXT: call void @callback2(void (i8*)* noundef bitcast (void (i32*)* @foo to void (i8*)*)) 76; IS__CGSCC____-NEXT: call void @callback2(void (i8*)* [[FP]]) 77; IS__CGSCC____-NEXT: call void [[FP]](i8* bitcast (void (i32*)* @foo to i8*)) 78; IS__CGSCC____-NEXT: [[TMP1:%.*]] = bitcast i32* [[A]] to i8* 79; IS__CGSCC____-NEXT: call void [[FP]](i8* [[TMP1]]) 80; IS__CGSCC____-NEXT: call void @internal(void (i8*)* noundef nonnull [[FP]]) 81; IS__CGSCC____-NEXT: ret void 82; 83entry: 84 %a = alloca i32, align 4 85 %tmp = bitcast i32* %a to i8* 86 call void @foo(i32* nonnull %a) 87 call void @callback1(void (i32*)* nonnull @foo) 88 call void @callback2(void (i8*)* bitcast (void (i32*)* @foo to void (i8*)*)) 89 call void @callback2(void (i8*)* %fp) 90 call void %fp(i8* bitcast (void (i32*)* @foo to i8*)) 91 %tmp1 = bitcast i32* %a to i8* 92 call void %fp(i8* %tmp1) 93 call void @internal(void (i8*)* %fp) 94 ret void 95} 96 97define internal void @foo(i32* %a) { 98; 99; IS__TUNIT____: Function Attrs: argmemonly nofree nosync nounwind willreturn writeonly 100; IS__TUNIT____-LABEL: define {{[^@]+}}@foo 101; IS__TUNIT____-SAME: (i32* nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[A:%.*]]) #[[ATTR0:[0-9]+]] { 102; IS__TUNIT____-NEXT: entry: 103; IS__TUNIT____-NEXT: store i32 0, i32* [[A]], align 4 104; IS__TUNIT____-NEXT: ret void 105; 106; IS__CGSCC____: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly 107; IS__CGSCC____-LABEL: define {{[^@]+}}@foo 108; IS__CGSCC____-SAME: (i32* nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[A:%.*]]) #[[ATTR0:[0-9]+]] { 109; IS__CGSCC____-NEXT: entry: 110; IS__CGSCC____-NEXT: store i32 0, i32* [[A]], align 4 111; IS__CGSCC____-NEXT: ret void 112; 113entry: 114 store i32 0, i32* %a 115 ret void 116} 117 118declare void @callback1(void (i32*)*) 119declare void @callback2(void (i8*)*) 120;. 121; IS__TUNIT____: attributes #[[ATTR0]] = { argmemonly nofree nosync nounwind willreturn writeonly } 122; IS__TUNIT____: attributes #[[ATTR1]] = { nofree nosync nounwind willreturn writeonly } 123;. 124; IS__CGSCC____: attributes #[[ATTR0]] = { argmemonly nofree norecurse nosync nounwind willreturn writeonly } 125; IS__CGSCC____: attributes #[[ATTR1]] = { nounwind willreturn writeonly } 126;. 127