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* 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: call void @foo(i32* nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[A]]) #[[ATTR1:[0-9]+]] 30; IS__CGSCC____-NEXT: call void [[FP]](i8* bitcast (void (i32*)* @foo to i8*)) 31; IS__CGSCC____-NEXT: call void @callback1(void (i32*)* noundef nonnull @foo) 32; IS__CGSCC____-NEXT: call void @callback2(void (i8*)* noundef bitcast (void (i32*)* @foo to void (i8*)*)) 33; IS__CGSCC____-NEXT: call void @callback2(void (i8*)* noundef nonnull [[FP]]) 34; IS__CGSCC____-NEXT: [[TMP1:%.*]] = bitcast i32* [[A]] to i8* 35; IS__CGSCC____-NEXT: call void [[FP]](i8* [[TMP1]]) 36; IS__CGSCC____-NEXT: ret void 37; 38entry: 39 %a = alloca i32, align 4 40 %tmp = bitcast i32* %a to i8* 41 call void @foo(i32* nonnull %a) 42 call void %fp(i8* bitcast (void (i32*)* @foo to i8*)) 43 call void @callback1(void (i32*)* nonnull @foo) 44 call void @callback2(void (i8*)* bitcast (void (i32*)* @foo to void (i8*)*)) 45 call void @callback2(void (i8*)* %fp) 46 %tmp1 = bitcast i32* %a to i8* 47 call void %fp(i8* %tmp1) 48 ret void 49} 50 51define void @external(void (i8*)* %fp) { 52; 53; 54; IS__TUNIT____-LABEL: define {{[^@]+}}@external 55; IS__TUNIT____-SAME: (void (i8*)* [[FP:%.*]]) { 56; IS__TUNIT____-NEXT: entry: 57; IS__TUNIT____-NEXT: [[A:%.*]] = alloca i32, align 4 58; IS__TUNIT____-NEXT: call void @foo(i32* nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[A]]) #[[ATTR1]] 59; IS__TUNIT____-NEXT: call void @callback1(void (i32*)* noundef nonnull @foo) 60; IS__TUNIT____-NEXT: call void @callback2(void (i8*)* noundef bitcast (void (i32*)* @foo to void (i8*)*)) 61; IS__TUNIT____-NEXT: call void @callback2(void (i8*)* [[FP]]) 62; IS__TUNIT____-NEXT: call void [[FP]](i8* bitcast (void (i32*)* @foo to i8*)) 63; IS__TUNIT____-NEXT: [[TMP1:%.*]] = bitcast i32* [[A]] to i8* 64; IS__TUNIT____-NEXT: call void [[FP]](i8* [[TMP1]]) 65; IS__TUNIT____-NEXT: call void @internal(void (i8*)* nonnull [[FP]]) 66; IS__TUNIT____-NEXT: ret void 67; 68; IS__CGSCC____-LABEL: define {{[^@]+}}@external 69; IS__CGSCC____-SAME: (void (i8*)* [[FP:%.*]]) { 70; IS__CGSCC____-NEXT: entry: 71; IS__CGSCC____-NEXT: [[A:%.*]] = alloca i32, align 4 72; IS__CGSCC____-NEXT: call void @foo(i32* nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[A]]) #[[ATTR1]] 73; IS__CGSCC____-NEXT: call void @callback1(void (i32*)* noundef nonnull @foo) 74; IS__CGSCC____-NEXT: call void @callback2(void (i8*)* noundef bitcast (void (i32*)* @foo to void (i8*)*)) 75; IS__CGSCC____-NEXT: call void @callback2(void (i8*)* [[FP]]) 76; IS__CGSCC____-NEXT: call void [[FP]](i8* bitcast (void (i32*)* @foo to i8*)) 77; IS__CGSCC____-NEXT: [[TMP1:%.*]] = bitcast i32* [[A]] to i8* 78; IS__CGSCC____-NEXT: call void [[FP]](i8* [[TMP1]]) 79; IS__CGSCC____-NEXT: call void @internal(void (i8*)* noundef nonnull [[FP]]) 80; IS__CGSCC____-NEXT: ret void 81; 82entry: 83 %a = alloca i32, align 4 84 %tmp = bitcast i32* %a to i8* 85 call void @foo(i32* nonnull %a) 86 call void @callback1(void (i32*)* nonnull @foo) 87 call void @callback2(void (i8*)* bitcast (void (i32*)* @foo to void (i8*)*)) 88 call void @callback2(void (i8*)* %fp) 89 call void %fp(i8* bitcast (void (i32*)* @foo to i8*)) 90 %tmp1 = bitcast i32* %a to i8* 91 call void %fp(i8* %tmp1) 92 call void @internal(void (i8*)* %fp) 93 ret void 94} 95 96define internal void @foo(i32* %a) { 97; 98; CHECK: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn writeonly 99; CHECK-LABEL: define {{[^@]+}}@foo 100; CHECK-SAME: (i32* nocapture nofree noundef nonnull writeonly align 4 dereferenceable(4) [[A:%.*]]) #[[ATTR0:[0-9]+]] { 101; CHECK-NEXT: entry: 102; CHECK-NEXT: store i32 0, i32* [[A]], align 4 103; CHECK-NEXT: ret void 104; 105entry: 106 store i32 0, i32* %a 107 ret void 108} 109 110declare void @callback1(void (i32*)*) 111declare void @callback2(void (i8*)*) 112;. 113; IS__TUNIT____: attributes #[[ATTR0]] = { argmemonly nofree norecurse nosync nounwind willreturn writeonly } 114; IS__TUNIT____: attributes #[[ATTR1]] = { nofree nosync nounwind willreturn writeonly } 115;. 116; IS__CGSCC____: attributes #[[ATTR0]] = { argmemonly nofree norecurse nosync nounwind willreturn writeonly } 117; IS__CGSCC____: attributes #[[ATTR1]] = { nounwind willreturn writeonly } 118;. 119