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=11 -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=11 -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 6target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 7target triple = "x86_64-unknown-linux-gnu" 8 9define void @fn2(i32* %P, i1 %C) { 10; 11; IS__TUNIT____: Function Attrs: argmemonly nofree norecurse nosync nounwind 12; IS__TUNIT____-LABEL: define {{[^@]+}}@fn2 13; IS__TUNIT____-SAME: (i32* nocapture nofree [[P:%.*]], i1 [[C:%.*]]) #[[ATTR0:[0-9]+]] { 14; IS__TUNIT____-NEXT: entry: 15; IS__TUNIT____-NEXT: br label [[IF_END:%.*]] 16; IS__TUNIT____: for.cond1: 17; IS__TUNIT____-NEXT: br i1 [[C]], label [[IF_END]], label [[EXIT:%.*]] 18; IS__TUNIT____: if.end: 19; IS__TUNIT____-NEXT: [[E_2:%.*]] = phi i32* [ [[P]], [[ENTRY:%.*]] ], [ null, [[FOR_COND1:%.*]] ] 20; IS__TUNIT____-NEXT: [[TMP0:%.*]] = load i32, i32* [[E_2]], align 4 21; IS__TUNIT____-NEXT: store i32 [[TMP0]], i32* [[P]], align 4 22; IS__TUNIT____-NEXT: br label [[FOR_COND1]] 23; IS__TUNIT____: exit: 24; IS__TUNIT____-NEXT: ret void 25; 26; IS__CGSCC____: Function Attrs: argmemonly nofree nosync nounwind 27; IS__CGSCC____-LABEL: define {{[^@]+}}@fn2 28; IS__CGSCC____-SAME: (i32* nocapture nofree nonnull align 4 dereferenceable(4) [[P:%.*]], i1 [[C:%.*]]) #[[ATTR0:[0-9]+]] { 29; IS__CGSCC____-NEXT: entry: 30; IS__CGSCC____-NEXT: br label [[IF_END:%.*]] 31; IS__CGSCC____: for.cond1: 32; IS__CGSCC____-NEXT: br i1 [[C]], label [[IF_END]], label [[EXIT:%.*]] 33; IS__CGSCC____: if.end: 34; IS__CGSCC____-NEXT: [[E_2:%.*]] = phi i32* [ [[P]], [[ENTRY:%.*]] ], [ null, [[FOR_COND1:%.*]] ] 35; IS__CGSCC____-NEXT: [[TMP0:%.*]] = load i32, i32* [[E_2]], align 4 36; IS__CGSCC____-NEXT: [[CALL:%.*]] = call i32 @fn1(i32 [[TMP0]]) 37; IS__CGSCC____-NEXT: store i32 [[CALL]], i32* [[P]], align 4 38; IS__CGSCC____-NEXT: br label [[FOR_COND1]] 39; IS__CGSCC____: exit: 40; IS__CGSCC____-NEXT: ret void 41; 42entry: 43 br label %if.end 44 45for.cond1: ; preds = %if.end 46 br i1 %C, label %if.end, label %exit 47 48if.end: ; preds = %entry, %for.cond1 49 %e.2 = phi i32* [ %P, %entry ], [ null, %for.cond1 ] 50 %0 = load i32, i32* %e.2, align 4 51 %call = call i32 @fn1(i32 %0) 52 store i32 %call, i32* %P 53 br label %for.cond1 54exit: 55 ret void 56} 57 58define internal i32 @fn1(i32 %p1) { 59; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 60; IS__CGSCC____-LABEL: define {{[^@]+}}@fn1 61; IS__CGSCC____-SAME: (i32 returned [[P1:%.*]]) #[[ATTR1:[0-9]+]] { 62; IS__CGSCC____-NEXT: entry: 63; IS__CGSCC____-NEXT: ret i32 [[P1]] 64; 65entry: 66 %tobool = icmp ne i32 %p1, 0 67 %cond = select i1 %tobool, i32 %p1, i32 %p1 68 ret i32 %cond 69} 70 71define void @fn_no_null_opt(i32* %P, i1 %C) null_pointer_is_valid { 72; 73; IS__TUNIT____: Function Attrs: nofree norecurse nosync nounwind null_pointer_is_valid 74; IS__TUNIT____-LABEL: define {{[^@]+}}@fn_no_null_opt 75; IS__TUNIT____-SAME: (i32* nocapture nofree writeonly [[P:%.*]], i1 [[C:%.*]]) #[[ATTR1:[0-9]+]] { 76; IS__TUNIT____-NEXT: entry: 77; IS__TUNIT____-NEXT: br label [[IF_END:%.*]] 78; IS__TUNIT____: for.cond1: 79; IS__TUNIT____-NEXT: br i1 [[C]], label [[IF_END]], label [[EXIT:%.*]] 80; IS__TUNIT____: if.end: 81; IS__TUNIT____-NEXT: [[E_2:%.*]] = phi i32* [ undef, [[ENTRY:%.*]] ], [ null, [[FOR_COND1:%.*]] ] 82; IS__TUNIT____-NEXT: [[TMP0:%.*]] = load i32, i32* null, align 4294967296 83; IS__TUNIT____-NEXT: store i32 [[TMP0]], i32* [[P]], align 4 84; IS__TUNIT____-NEXT: br label [[FOR_COND1]] 85; IS__TUNIT____: exit: 86; IS__TUNIT____-NEXT: ret void 87; 88; IS__CGSCC____: Function Attrs: nofree nosync nounwind null_pointer_is_valid 89; IS__CGSCC____-LABEL: define {{[^@]+}}@fn_no_null_opt 90; IS__CGSCC____-SAME: (i32* nocapture nofree writeonly align 4 dereferenceable_or_null(4) [[P:%.*]], i1 [[C:%.*]]) #[[ATTR2:[0-9]+]] { 91; IS__CGSCC____-NEXT: entry: 92; IS__CGSCC____-NEXT: br label [[IF_END:%.*]] 93; IS__CGSCC____: for.cond1: 94; IS__CGSCC____-NEXT: br i1 [[C]], label [[IF_END]], label [[EXIT:%.*]] 95; IS__CGSCC____: if.end: 96; IS__CGSCC____-NEXT: [[E_2:%.*]] = phi i32* [ undef, [[ENTRY:%.*]] ], [ null, [[FOR_COND1:%.*]] ] 97; IS__CGSCC____-NEXT: [[TMP0:%.*]] = load i32, i32* null, align 4294967296 98; IS__CGSCC____-NEXT: [[CALL:%.*]] = call i32 @fn0(i32 [[TMP0]]) 99; IS__CGSCC____-NEXT: store i32 [[CALL]], i32* [[P]], align 4 100; IS__CGSCC____-NEXT: br label [[FOR_COND1]] 101; IS__CGSCC____: exit: 102; IS__CGSCC____-NEXT: ret void 103; 104entry: 105 br label %if.end 106 107for.cond1: ; preds = %if.end 108 br i1 %C, label %if.end, label %exit 109 110if.end: ; preds = %entry, %for.cond1 111 %e.2 = phi i32* [ undef, %entry ], [ null, %for.cond1 ] 112 %0 = load i32, i32* %e.2, align 4 113 %call = call i32 @fn0(i32 %0) 114 store i32 %call, i32* %P 115 br label %for.cond1 116exit: 117 ret void 118} 119 120define internal i32 @fn0(i32 %p1) { 121; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 122; IS__CGSCC____-LABEL: define {{[^@]+}}@fn0 123; IS__CGSCC____-SAME: (i32 returned [[P1:%.*]]) #[[ATTR1]] { 124; IS__CGSCC____-NEXT: entry: 125; IS__CGSCC____-NEXT: ret i32 [[P1]] 126; 127entry: 128 %tobool = icmp ne i32 %p1, 0 129 %cond = select i1 %tobool, i32 %p1, i32 %p1 130 ret i32 %cond 131} 132;. 133; IS__TUNIT____: attributes #[[ATTR0]] = { argmemonly nofree norecurse nosync nounwind } 134; IS__TUNIT____: attributes #[[ATTR1]] = { nofree norecurse nosync nounwind null_pointer_is_valid } 135;. 136; IS__CGSCC____: attributes #[[ATTR0]] = { argmemonly nofree nosync nounwind } 137; IS__CGSCC____: attributes #[[ATTR1]] = { nofree norecurse nosync nounwind readnone willreturn } 138; IS__CGSCC____: attributes #[[ATTR2]] = { nofree nosync nounwind null_pointer_is_valid } 139;. 140