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