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=14 -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=14 -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 7define void @f() { 8; IS________OPM-LABEL: define {{[^@]+}}@f() { 9; IS________OPM-NEXT: entry: 10; IS________OPM-NEXT: [[A:%.*]] = alloca i32, align 1 11; IS________OPM-NEXT: call void @g(i32* noalias nocapture nofree noundef nonnull readonly dereferenceable(4) [[A]]) 12; IS________OPM-NEXT: ret void 13; 14; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@f() { 15; IS__TUNIT_NPM-NEXT: entry: 16; IS__TUNIT_NPM-NEXT: [[A:%.*]] = alloca i32, align 1 17; IS__TUNIT_NPM-NEXT: [[TMP0:%.*]] = load i32, i32* [[A]], align 1 18; IS__TUNIT_NPM-NEXT: call void @g(i32 [[TMP0]]) 19; IS__TUNIT_NPM-NEXT: ret void 20; 21; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@f() { 22; IS__CGSCC_NPM-NEXT: entry: 23; IS__CGSCC_NPM-NEXT: call void @g(i32 undef) 24; IS__CGSCC_NPM-NEXT: ret void 25; 26entry: 27 %a = alloca i32, align 1 28 call void @g(i32* %a) 29 ret void 30} 31 32define internal void @g(i32* %a) { 33; IS________OPM-LABEL: define {{[^@]+}}@g 34; IS________OPM-SAME: (i32* noalias nocapture nofree noundef nonnull readonly dereferenceable(4) [[A:%.*]]) { 35; IS________OPM-NEXT: [[AA:%.*]] = load i32, i32* [[A]], align 1 36; IS________OPM-NEXT: call void @z(i32 [[AA]]) 37; IS________OPM-NEXT: ret void 38; 39; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@g 40; IS__TUNIT_NPM-SAME: (i32 [[TMP0:%.*]]) { 41; IS__TUNIT_NPM-NEXT: [[A_PRIV:%.*]] = alloca i32, align 4 42; IS__TUNIT_NPM-NEXT: store i32 [[TMP0]], i32* [[A_PRIV]], align 4 43; IS__TUNIT_NPM-NEXT: [[AA:%.*]] = load i32, i32* [[A_PRIV]], align 1 44; IS__TUNIT_NPM-NEXT: call void @z(i32 [[AA]]) 45; IS__TUNIT_NPM-NEXT: ret void 46; 47; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@g 48; IS__CGSCC_NPM-SAME: (i32 [[TMP0:%.*]]) { 49; IS__CGSCC_NPM-NEXT: [[A_PRIV:%.*]] = alloca i32, align 4 50; IS__CGSCC_NPM-NEXT: [[AA:%.*]] = load i32, i32* [[A_PRIV]], align 4 51; IS__CGSCC_NPM-NEXT: call void @z(i32 undef) 52; IS__CGSCC_NPM-NEXT: ret void 53; 54 %aa = load i32, i32* %a, align 1 55 call void @z(i32 %aa) 56 ret void 57} 58 59declare void @z(i32) 60 61; Test2 62; Different alignemnt privatizable arguments 63define internal i32 @test(i32* %X, i64* %Y) { 64; IS__TUNIT_OPM: Function Attrs: argmemonly nofree nosync nounwind readonly willreturn 65; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@test 66; IS__TUNIT_OPM-SAME: (i32* noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[X:%.*]], i64* noalias nocapture nofree noundef nonnull readonly align 8 dereferenceable(8) [[Y:%.*]]) #[[ATTR0:[0-9]+]] { 67; IS__TUNIT_OPM-NEXT: [[A:%.*]] = load i32, i32* [[X]], align 4 68; IS__TUNIT_OPM-NEXT: [[B:%.*]] = load i64, i64* [[Y]], align 8 69; IS__TUNIT_OPM-NEXT: [[C:%.*]] = add i32 [[A]], 1 70; IS__TUNIT_OPM-NEXT: [[D:%.*]] = add i64 [[B]], 1 71; IS__TUNIT_OPM-NEXT: [[COND:%.*]] = icmp sgt i64 [[D]], -1 72; IS__TUNIT_OPM-NEXT: br i1 [[COND]], label [[RETURN1:%.*]], label [[RETURN2:%.*]] 73; IS__TUNIT_OPM: Return1: 74; IS__TUNIT_OPM-NEXT: ret i32 [[C]] 75; IS__TUNIT_OPM: Return2: 76; IS__TUNIT_OPM-NEXT: ret i32 [[A]] 77; 78; IS__TUNIT_NPM: Function Attrs: argmemonly nofree nosync nounwind readonly willreturn 79; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@test 80; IS__TUNIT_NPM-SAME: (i32 [[TMP0:%.*]], i64 [[TMP1:%.*]]) #[[ATTR0:[0-9]+]] { 81; IS__TUNIT_NPM-NEXT: [[Y_PRIV:%.*]] = alloca i64, align 8 82; IS__TUNIT_NPM-NEXT: store i64 [[TMP1]], i64* [[Y_PRIV]], align 4 83; IS__TUNIT_NPM-NEXT: [[X_PRIV:%.*]] = alloca i32, align 4 84; IS__TUNIT_NPM-NEXT: store i32 [[TMP0]], i32* [[X_PRIV]], align 4 85; IS__TUNIT_NPM-NEXT: [[A:%.*]] = load i32, i32* [[X_PRIV]], align 4 86; IS__TUNIT_NPM-NEXT: [[B:%.*]] = load i64, i64* [[Y_PRIV]], align 8 87; IS__TUNIT_NPM-NEXT: [[C:%.*]] = add i32 [[A]], 1 88; IS__TUNIT_NPM-NEXT: [[D:%.*]] = add i64 [[B]], 1 89; IS__TUNIT_NPM-NEXT: [[COND:%.*]] = icmp sgt i64 [[D]], -1 90; IS__TUNIT_NPM-NEXT: br i1 [[COND]], label [[RETURN1:%.*]], label [[RETURN2:%.*]] 91; IS__TUNIT_NPM: Return1: 92; IS__TUNIT_NPM-NEXT: ret i32 [[C]] 93; IS__TUNIT_NPM: Return2: 94; IS__TUNIT_NPM-NEXT: ret i32 [[A]] 95; 96; IS__CGSCC_OPM: Function Attrs: argmemonly nofree norecurse nosync nounwind readonly willreturn 97; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@test 98; IS__CGSCC_OPM-SAME: (i32* noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[X:%.*]], i64* noalias nocapture nofree noundef nonnull readonly align 8 dereferenceable(8) [[Y:%.*]]) #[[ATTR0:[0-9]+]] { 99; IS__CGSCC_OPM-NEXT: [[A:%.*]] = load i32, i32* [[X]], align 4 100; IS__CGSCC_OPM-NEXT: [[B:%.*]] = load i64, i64* [[Y]], align 8 101; IS__CGSCC_OPM-NEXT: [[C:%.*]] = add i32 [[A]], 1 102; IS__CGSCC_OPM-NEXT: [[D:%.*]] = add i64 [[B]], 1 103; IS__CGSCC_OPM-NEXT: [[COND:%.*]] = icmp sgt i64 [[D]], -1 104; IS__CGSCC_OPM-NEXT: br i1 [[COND]], label [[RETURN1:%.*]], label [[RETURN2:%.*]] 105; IS__CGSCC_OPM: Return1: 106; IS__CGSCC_OPM-NEXT: ret i32 [[C]] 107; IS__CGSCC_OPM: Return2: 108; IS__CGSCC_OPM-NEXT: ret i32 [[A]] 109; 110; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 111; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@test 112; IS__CGSCC_NPM-SAME: (i32 [[TMP0:%.*]], i64 [[TMP1:%.*]]) #[[ATTR0:[0-9]+]] { 113; IS__CGSCC_NPM-NEXT: [[Y_PRIV:%.*]] = alloca i64, align 8 114; IS__CGSCC_NPM-NEXT: [[X_PRIV:%.*]] = alloca i32, align 4 115; IS__CGSCC_NPM-NEXT: store i32 2, i32* [[X_PRIV]], align 4 116; IS__CGSCC_NPM-NEXT: [[A:%.*]] = load i32, i32* [[X_PRIV]], align 4 117; IS__CGSCC_NPM-NEXT: [[B:%.*]] = load i64, i64* [[Y_PRIV]], align 8 118; IS__CGSCC_NPM-NEXT: [[C:%.*]] = add i32 2, 1 119; IS__CGSCC_NPM-NEXT: [[D:%.*]] = add i64 1, 1 120; IS__CGSCC_NPM-NEXT: [[COND:%.*]] = icmp sgt i64 2, -1 121; IS__CGSCC_NPM-NEXT: br i1 true, label [[RETURN1:%.*]], label [[RETURN2:%.*]] 122; IS__CGSCC_NPM: Return1: 123; IS__CGSCC_NPM-NEXT: ret i32 3 124; IS__CGSCC_NPM: Return2: 125; IS__CGSCC_NPM-NEXT: ret i32 2 126; 127 %A = load i32, i32* %X 128 %B = load i64, i64* %Y 129 %C = add i32 %A, 1 130 %D = add i64 %B, 1 131 %cond = icmp sgt i64 %D, -1 132 br i1 %cond, label %Return1, label %Return2 133Return1: 134 ret i32 %C 135Return2: 136 ret i32 %A 137} 138 139define internal i32 @caller(i32* %A) { 140; IS__TUNIT_OPM: Function Attrs: argmemonly nofree nosync nounwind willreturn 141; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@caller 142; IS__TUNIT_OPM-SAME: (i32* noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[A:%.*]]) #[[ATTR1:[0-9]+]] { 143; IS__TUNIT_OPM-NEXT: [[B:%.*]] = alloca i64, align 8 144; IS__TUNIT_OPM-NEXT: store i64 1, i64* [[B]], align 8 145; IS__TUNIT_OPM-NEXT: [[C:%.*]] = call i32 @test(i32* noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[A]], i64* noalias nocapture nofree noundef nonnull readonly align 8 dereferenceable(8) [[B]]) #[[ATTR3:[0-9]+]] 146; IS__TUNIT_OPM-NEXT: ret i32 [[C]] 147; 148; IS__TUNIT_NPM: Function Attrs: argmemonly nofree nosync nounwind willreturn 149; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@caller 150; IS__TUNIT_NPM-SAME: (i32 [[TMP0:%.*]]) #[[ATTR1:[0-9]+]] { 151; IS__TUNIT_NPM-NEXT: [[A_PRIV:%.*]] = alloca i32, align 4 152; IS__TUNIT_NPM-NEXT: store i32 [[TMP0]], i32* [[A_PRIV]], align 4 153; IS__TUNIT_NPM-NEXT: [[B:%.*]] = alloca i64, align 8 154; IS__TUNIT_NPM-NEXT: store i64 1, i64* [[B]], align 8 155; IS__TUNIT_NPM-NEXT: [[TMP2:%.*]] = load i32, i32* [[A_PRIV]], align 4 156; IS__TUNIT_NPM-NEXT: [[TMP3:%.*]] = load i64, i64* [[B]], align 8 157; IS__TUNIT_NPM-NEXT: [[C:%.*]] = call i32 @test(i32 [[TMP2]], i64 [[TMP3]]) #[[ATTR3:[0-9]+]] 158; IS__TUNIT_NPM-NEXT: ret i32 [[C]] 159; 160; IS__CGSCC_OPM: Function Attrs: argmemonly nofree norecurse nosync nounwind willreturn 161; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@caller 162; IS__CGSCC_OPM-SAME: (i32* noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[A:%.*]]) #[[ATTR1:[0-9]+]] { 163; IS__CGSCC_OPM-NEXT: [[B:%.*]] = alloca i64, align 8 164; IS__CGSCC_OPM-NEXT: store i64 1, i64* [[B]], align 8 165; IS__CGSCC_OPM-NEXT: [[C:%.*]] = call i32 @test(i32* noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[A]], i64* noalias nocapture nofree noundef nonnull readonly align 8 dereferenceable(8) [[B]]) #[[ATTR3:[0-9]+]] 166; IS__CGSCC_OPM-NEXT: ret i32 [[C]] 167; 168; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 169; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@caller 170; IS__CGSCC_NPM-SAME: (i32 [[TMP0:%.*]]) #[[ATTR0]] { 171; IS__CGSCC_NPM-NEXT: [[A_PRIV:%.*]] = alloca i32, align 4 172; IS__CGSCC_NPM-NEXT: [[TMP2:%.*]] = load i32, i32* [[A_PRIV]], align 4 173; IS__CGSCC_NPM-NEXT: [[C:%.*]] = call i32 @test(i32 undef, i64 undef) #[[ATTR1:[0-9]+]], !range [[RNG0:![0-9]+]] 174; IS__CGSCC_NPM-NEXT: ret i32 [[C]] 175; 176 %B = alloca i64 177 store i64 1, i64* %B 178 %C = call i32 @test(i32* %A, i64* %B) 179 ret i32 %C 180} 181 182define i32 @callercaller() { 183; IS__TUNIT_OPM: Function Attrs: nofree nosync nounwind readnone 184; IS__TUNIT_OPM-LABEL: define {{[^@]+}}@callercaller 185; IS__TUNIT_OPM-SAME: () #[[ATTR2:[0-9]+]] { 186; IS__TUNIT_OPM-NEXT: [[B:%.*]] = alloca i32, align 4 187; IS__TUNIT_OPM-NEXT: store i32 2, i32* [[B]], align 4 188; IS__TUNIT_OPM-NEXT: [[X:%.*]] = call i32 @caller(i32* noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[B]]) #[[ATTR4:[0-9]+]] 189; IS__TUNIT_OPM-NEXT: ret i32 [[X]] 190; 191; IS__TUNIT_NPM: Function Attrs: nofree nosync nounwind readnone 192; IS__TUNIT_NPM-LABEL: define {{[^@]+}}@callercaller 193; IS__TUNIT_NPM-SAME: () #[[ATTR2:[0-9]+]] { 194; IS__TUNIT_NPM-NEXT: [[B:%.*]] = alloca i32, align 4 195; IS__TUNIT_NPM-NEXT: store i32 2, i32* [[B]], align 4 196; IS__TUNIT_NPM-NEXT: [[TMP1:%.*]] = load i32, i32* [[B]], align 4 197; IS__TUNIT_NPM-NEXT: [[X:%.*]] = call i32 @caller(i32 [[TMP1]]) #[[ATTR4:[0-9]+]] 198; IS__TUNIT_NPM-NEXT: ret i32 [[X]] 199; 200; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 201; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@callercaller 202; IS__CGSCC_OPM-SAME: () #[[ATTR2:[0-9]+]] { 203; IS__CGSCC_OPM-NEXT: [[B:%.*]] = alloca i32, align 4 204; IS__CGSCC_OPM-NEXT: store i32 2, i32* [[B]], align 4 205; IS__CGSCC_OPM-NEXT: [[X:%.*]] = call i32 @caller(i32* noalias nocapture nofree noundef nonnull readonly align 4 dereferenceable(4) [[B]]) #[[ATTR4:[0-9]+]] 206; IS__CGSCC_OPM-NEXT: ret i32 [[X]] 207; 208; IS__CGSCC_NPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn 209; IS__CGSCC_NPM-LABEL: define {{[^@]+}}@callercaller 210; IS__CGSCC_NPM-SAME: () #[[ATTR0]] { 211; IS__CGSCC_NPM-NEXT: [[X:%.*]] = call i32 @caller(i32 undef) #[[ATTR2:[0-9]+]] 212; IS__CGSCC_NPM-NEXT: ret i32 [[X]] 213; 214 %B = alloca i32 215 store i32 2, i32* %B 216 %X = call i32 @caller(i32* %B) 217 ret i32 %X 218} 219;. 220; IS__TUNIT____: attributes #[[ATTR0:[0-9]+]] = { argmemonly nofree nosync nounwind readonly willreturn } 221; IS__TUNIT____: attributes #[[ATTR1:[0-9]+]] = { argmemonly nofree nosync nounwind willreturn } 222; IS__TUNIT____: attributes #[[ATTR2:[0-9]+]] = { nofree nosync nounwind readnone } 223; IS__TUNIT____: attributes #[[ATTR3:[0-9]+]] = { nofree nosync nounwind readonly willreturn } 224; IS__TUNIT____: attributes #[[ATTR4:[0-9]+]] = { nofree nosync nounwind willreturn } 225;. 226; IS__CGSCC_OPM: attributes #[[ATTR0]] = { argmemonly nofree norecurse nosync nounwind readonly willreturn } 227; IS__CGSCC_OPM: attributes #[[ATTR1]] = { argmemonly nofree norecurse nosync nounwind willreturn } 228; IS__CGSCC_OPM: attributes #[[ATTR2]] = { nofree norecurse nosync nounwind readnone willreturn } 229; IS__CGSCC_OPM: attributes #[[ATTR3]] = { nosync nounwind readonly willreturn } 230; IS__CGSCC_OPM: attributes #[[ATTR4]] = { nounwind willreturn } 231;. 232; IS__CGSCC_NPM: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind readnone willreturn } 233; IS__CGSCC_NPM: attributes #[[ATTR1]] = { nosync nounwind readnone willreturn } 234; IS__CGSCC_NPM: attributes #[[ATTR2]] = { nounwind readnone willreturn } 235;. 236; IS__CGSCC_NPM: [[RNG0]] = !{i32 0, i32 4} 237;. 238