brintos

brintos / llvm-project-archived public Read only

0
0
Text · 13.6 KiB · 28dd5b2 Raw
224 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals2; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal  -attributor-annotate-decl-cs  -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT3; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal  -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC4 5define dso_local i32 @visible(ptr noalias %A, ptr noalias %B) #0 {6; TUNIT: Function Attrs: mustprogress nofree noinline norecurse nosync nounwind willreturn memory(argmem: read) uwtable7; TUNIT-LABEL: define {{[^@]+}}@visible8; TUNIT-SAME: (ptr noalias nofree readonly captures(none) [[A:%.*]], ptr noalias nofree readonly captures(none) [[B:%.*]]) #[[ATTR0:[0-9]+]] {9; TUNIT-NEXT:  entry:10; TUNIT-NEXT:    [[CALL1:%.*]] = call i32 @noalias_args(ptr noalias nofree noundef readonly align 4 captures(none) [[A]], ptr noalias nofree noundef readonly align 4 captures(none) [[B]]) #[[ATTR4:[0-9]+]]11; TUNIT-NEXT:    [[CALL2:%.*]] = call i32 @noalias_args_argmem(ptr noalias nofree noundef readonly align 4 captures(none) [[A]], ptr noalias nofree noundef readonly align 4 captures(none) [[B]]) #[[ATTR4]]12; TUNIT-NEXT:    [[ADD:%.*]] = add nsw i32 [[CALL1]], [[CALL2]]13; TUNIT-NEXT:    ret i32 [[ADD]]14;15; CGSCC: Function Attrs: mustprogress nofree noinline nosync nounwind willreturn memory(argmem: read) uwtable16; CGSCC-LABEL: define {{[^@]+}}@visible17; CGSCC-SAME: (ptr noalias nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[A:%.*]], ptr noalias nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[B:%.*]]) #[[ATTR0:[0-9]+]] {18; CGSCC-NEXT:  entry:19; CGSCC-NEXT:    [[CALL1:%.*]] = call i32 @noalias_args(ptr noalias nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[A]], ptr noalias nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[B]]) #[[ATTR6:[0-9]+]]20; CGSCC-NEXT:    [[CALL2:%.*]] = call i32 @noalias_args_argmem(ptr noalias nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[A]], ptr noalias nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[B]]) #[[ATTR6]]21; CGSCC-NEXT:    [[ADD:%.*]] = add nsw i32 [[CALL1]], [[CALL2]]22; CGSCC-NEXT:    ret i32 [[ADD]]23;24entry:25  %call1 = call i32 @noalias_args(ptr %A, ptr %B)26  %call2 = call i32 @noalias_args_argmem(ptr %A, ptr %B)27  %add = add nsw i32 %call1, %call228  ret i32 %add29}30 31define private i32 @noalias_args(ptr %A, ptr %B) #0 {32; TUNIT: Function Attrs: mustprogress nofree noinline norecurse nosync nounwind willreturn memory(argmem: read) uwtable33; TUNIT-LABEL: define {{[^@]+}}@noalias_args34; TUNIT-SAME: (ptr nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[A:%.*]], ptr noalias nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[B:%.*]]) #[[ATTR0]] {35; TUNIT-NEXT:  entry:36; TUNIT-NEXT:    [[TMP0:%.*]] = load i32, ptr [[A]], align 437; TUNIT-NEXT:    [[TMP1:%.*]] = load i32, ptr [[B]], align 438; TUNIT-NEXT:    [[ADD:%.*]] = add nsw i32 [[TMP0]], [[TMP1]]39; TUNIT-NEXT:    [[CALL:%.*]] = call i32 @noalias_args_argmem(ptr nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[A]], ptr noalias nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[B]]) #[[ATTR4]]40; TUNIT-NEXT:    [[ADD2:%.*]] = add nsw i32 [[ADD]], [[CALL]]41; TUNIT-NEXT:    ret i32 [[ADD2]]42;43; CGSCC: Function Attrs: mustprogress nofree noinline nosync nounwind willreturn memory(argmem: read) uwtable44; CGSCC-LABEL: define {{[^@]+}}@noalias_args45; CGSCC-SAME: (ptr nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[A:%.*]], ptr noalias nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[B:%.*]]) #[[ATTR0]] {46; CGSCC-NEXT:  entry:47; CGSCC-NEXT:    [[TMP0:%.*]] = load i32, ptr [[A]], align 448; CGSCC-NEXT:    [[TMP1:%.*]] = load i32, ptr [[B]], align 449; CGSCC-NEXT:    [[ADD:%.*]] = add nsw i32 [[TMP0]], [[TMP1]]50; CGSCC-NEXT:    [[CALL:%.*]] = call i32 @noalias_args_argmem(ptr nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[A]], ptr noalias nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[B]]) #[[ATTR7:[0-9]+]]51; CGSCC-NEXT:    [[ADD2:%.*]] = add nsw i32 [[ADD]], [[CALL]]52; CGSCC-NEXT:    ret i32 [[ADD2]]53;54entry:55  %0 = load i32, ptr %A, align 456  %1 = load i32, ptr %B, align 457  %add = add nsw i32 %0, %158  %call = call i32 @noalias_args_argmem(ptr %A, ptr %B)59  %add2 = add nsw i32 %add, %call60  ret i32 %add261}62 63 64define internal i32 @noalias_args_argmem(ptr %A, ptr %B) #1 {65; TUNIT: Function Attrs: mustprogress nofree noinline norecurse nosync nounwind willreturn memory(argmem: read) uwtable66; TUNIT-LABEL: define {{[^@]+}}@noalias_args_argmem67; TUNIT-SAME: (ptr nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[A:%.*]], ptr noalias nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[B:%.*]]) #[[ATTR0]] {68; TUNIT-NEXT:  entry:69; TUNIT-NEXT:    [[TMP0:%.*]] = load i32, ptr [[A]], align 470; TUNIT-NEXT:    [[TMP1:%.*]] = load i32, ptr [[B]], align 471; TUNIT-NEXT:    [[ADD:%.*]] = add nsw i32 [[TMP0]], [[TMP1]]72; TUNIT-NEXT:    ret i32 [[ADD]]73;74; CGSCC: Function Attrs: mustprogress nofree noinline norecurse nosync nounwind willreturn memory(argmem: read) uwtable75; CGSCC-LABEL: define {{[^@]+}}@noalias_args_argmem76; CGSCC-SAME: (ptr nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[A:%.*]], ptr nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[B:%.*]]) #[[ATTR1:[0-9]+]] {77; CGSCC-NEXT:  entry:78; CGSCC-NEXT:    [[TMP0:%.*]] = load i32, ptr [[A]], align 479; CGSCC-NEXT:    [[TMP1:%.*]] = load i32, ptr [[B]], align 480; CGSCC-NEXT:    [[ADD:%.*]] = add nsw i32 [[TMP0]], [[TMP1]]81; CGSCC-NEXT:    ret i32 [[ADD]]82;83entry:84  %0 = load i32, ptr %A, align 485  %1 = load i32, ptr %B, align 486  %add = add nsw i32 %0, %187  ret i32 %add88}89 90define dso_local i32 @visible_local(ptr %A) #0 {91; TUNIT: Function Attrs: mustprogress nofree noinline norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable92; TUNIT-LABEL: define {{[^@]+}}@visible_local93; TUNIT-SAME: (ptr nofree readonly captures(none) [[A:%.*]]) #[[ATTR1:[0-9]+]] {94; TUNIT-NEXT:  entry:95; TUNIT-NEXT:    [[B:%.*]] = alloca i32, align 496; TUNIT-NEXT:    store i32 5, ptr [[B]], align 497; TUNIT-NEXT:    [[CALL1:%.*]] = call i32 @noalias_args(ptr nofree noundef readonly align 4 captures(none) [[A]], ptr noalias nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[B]]) #[[ATTR4]]98; TUNIT-NEXT:    [[CALL2:%.*]] = call i32 @noalias_args_argmem(ptr nofree noundef readonly align 4 captures(none) [[A]], ptr noalias nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[B]]) #[[ATTR4]]99; TUNIT-NEXT:    [[ADD:%.*]] = add nsw i32 [[CALL1]], [[CALL2]]100; TUNIT-NEXT:    ret i32 [[ADD]]101;102; CGSCC: Function Attrs: mustprogress nofree noinline nosync nounwind willreturn memory(argmem: readwrite) uwtable103; CGSCC-LABEL: define {{[^@]+}}@visible_local104; CGSCC-SAME: (ptr nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[A:%.*]]) #[[ATTR2:[0-9]+]] {105; CGSCC-NEXT:  entry:106; CGSCC-NEXT:    [[B:%.*]] = alloca i32, align 4107; CGSCC-NEXT:    store i32 5, ptr [[B]], align 4108; CGSCC-NEXT:    [[CALL1:%.*]] = call i32 @noalias_args(ptr nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[A]], ptr noalias nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[B]]) #[[ATTR6]]109; CGSCC-NEXT:    [[CALL2:%.*]] = call i32 @noalias_args_argmem(ptr nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[A]], ptr noalias nofree noundef nonnull readonly align 4 captures(none) dereferenceable(4) [[B]]) #[[ATTR8:[0-9]+]]110; CGSCC-NEXT:    [[ADD:%.*]] = add nsw i32 [[CALL1]], [[CALL2]]111; CGSCC-NEXT:    ret i32 [[ADD]]112;113entry:114  %B = alloca i32, align 4115  store i32 5, ptr %B, align 4116  %call1 = call i32 @noalias_args(ptr %A, ptr nonnull %B)117  %call2 = call i32 @noalias_args_argmem(ptr %A, ptr nonnull %B)118  %add = add nsw i32 %call1, %call2119  ret i32 %add120}121 122define internal i32 @noalias_args_argmem_ro(ptr %A, ptr %B) #1 {123; CGSCC: Function Attrs: mustprogress nofree noinline norecurse nosync nounwind willreturn memory(none) uwtable124; CGSCC-LABEL: define {{[^@]+}}@noalias_args_argmem_ro125; CGSCC-SAME: (i32 [[TMP0:%.*]], i32 [[TMP1:%.*]]) #[[ATTR3:[0-9]+]] {126; CGSCC-NEXT:    [[B_PRIV:%.*]] = alloca i32, align 4127; CGSCC-NEXT:    store i32 [[TMP1]], ptr [[B_PRIV]], align 4128; CGSCC-NEXT:    [[A_PRIV:%.*]] = alloca i32, align 4129; CGSCC-NEXT:    store i32 [[TMP0]], ptr [[A_PRIV]], align 4130; CGSCC-NEXT:    [[T0:%.*]] = load i32, ptr [[A_PRIV]], align 4131; CGSCC-NEXT:    [[T1:%.*]] = load i32, ptr [[B_PRIV]], align 4132; CGSCC-NEXT:    [[ADD:%.*]] = add nsw i32 [[T0]], [[T1]]133; CGSCC-NEXT:    ret i32 [[ADD]]134;135  %t0 = load i32, ptr %A, align 4136  %t1 = load i32, ptr %B, align 4137  %add = add nsw i32 %t0, %t1138  ret i32 %add139}140 141define i32 @visible_local_2() {142; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)143; TUNIT-LABEL: define {{[^@]+}}@visible_local_2144; TUNIT-SAME: () #[[ATTR2:[0-9]+]] {145; TUNIT-NEXT:    [[B:%.*]] = alloca i32, align 4146; TUNIT-NEXT:    ret i32 10147;148; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)149; CGSCC-LABEL: define {{[^@]+}}@visible_local_2150; CGSCC-SAME: () #[[ATTR4:[0-9]+]] {151; CGSCC-NEXT:    [[CALL:%.*]] = call i32 @noalias_args_argmem_ro(i32 noundef 5, i32 noundef 5) #[[ATTR9:[0-9]+]]152; CGSCC-NEXT:    ret i32 [[CALL]]153;154  %B = alloca i32, align 4155  store i32 5, ptr %B, align 4156  %call = call i32 @noalias_args_argmem_ro(ptr %B, ptr %B)157  ret i32 %call158}159 160define internal i32 @noalias_args_argmem_rn(ptr %A, ptr %B) #1 {161; TUNIT: Function Attrs: mustprogress nofree noinline norecurse nosync nounwind willreturn memory(argmem: write) uwtable162; TUNIT-LABEL: define {{[^@]+}}@noalias_args_argmem_rn163; TUNIT-SAME: (ptr noalias nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(4) [[B:%.*]]) #[[ATTR3:[0-9]+]] {164; TUNIT-NEXT:    ret i32 undef165;166; CGSCC: Function Attrs: mustprogress nofree noinline norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable167; CGSCC-LABEL: define {{[^@]+}}@noalias_args_argmem_rn168; CGSCC-SAME: (ptr noalias nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[B:%.*]]) #[[ATTR5:[0-9]+]] {169; CGSCC-NEXT:    [[T0:%.*]] = load i32, ptr [[B]], align 4170; CGSCC-NEXT:    store i32 0, ptr [[B]], align 4171; CGSCC-NEXT:    ret i32 [[T0]]172;173  %t0 = load i32, ptr %B, align 4174  store i32 0, ptr %B175  ret i32 %t0176}177 178define i32 @visible_local_3() {179; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)180; TUNIT-LABEL: define {{[^@]+}}@visible_local_3181; TUNIT-SAME: () #[[ATTR2]] {182; TUNIT-NEXT:    [[B:%.*]] = alloca i32, align 4183; TUNIT-NEXT:    [[CALL:%.*]] = call i32 @noalias_args_argmem_rn(ptr noalias nofree noundef nonnull writeonly align 4 captures(none) dereferenceable(4) [[B]]) #[[ATTR5:[0-9]+]]184; TUNIT-NEXT:    ret i32 5185;186; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)187; CGSCC-LABEL: define {{[^@]+}}@visible_local_3188; CGSCC-SAME: () #[[ATTR4]] {189; CGSCC-NEXT:    [[B:%.*]] = alloca i32, align 4190; CGSCC-NEXT:    store i32 5, ptr [[B]], align 4191; CGSCC-NEXT:    [[CALL:%.*]] = call i32 @noalias_args_argmem_rn(ptr noalias nofree noundef nonnull align 4 captures(none) dereferenceable(4) [[B]]) #[[ATTR10:[0-9]+]]192; CGSCC-NEXT:    ret i32 [[CALL]]193;194  %B = alloca i32, align 4195  store i32 5, ptr %B, align 4196  %call = call i32 @noalias_args_argmem_rn(ptr %B, ptr %B)197  ret i32 %call198}199 200attributes #0 = { noinline nounwind uwtable willreturn }201attributes #1 = { argmemonly noinline nounwind uwtable willreturn}202;.203; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree noinline norecurse nosync nounwind willreturn memory(argmem: read) uwtable }204; TUNIT: attributes #[[ATTR1]] = { mustprogress nofree noinline norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable }205; TUNIT: attributes #[[ATTR2]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }206; TUNIT: attributes #[[ATTR3]] = { mustprogress nofree noinline norecurse nosync nounwind willreturn memory(argmem: write) uwtable }207; TUNIT: attributes #[[ATTR4]] = { nofree nosync nounwind memory(read) }208; TUNIT: attributes #[[ATTR5]] = { nofree nosync nounwind willreturn memory(write) }209;.210; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree noinline nosync nounwind willreturn memory(argmem: read) uwtable }211; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree noinline norecurse nosync nounwind willreturn memory(argmem: read) uwtable }212; CGSCC: attributes #[[ATTR2]] = { mustprogress nofree noinline nosync nounwind willreturn memory(argmem: readwrite) uwtable }213; CGSCC: attributes #[[ATTR3]] = { mustprogress nofree noinline norecurse nosync nounwind willreturn memory(none) uwtable }214; CGSCC: attributes #[[ATTR4]] = { mustprogress nofree nosync nounwind willreturn memory(none) }215; CGSCC: attributes #[[ATTR5]] = { mustprogress nofree noinline norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable }216; CGSCC: attributes #[[ATTR6]] = { nofree memory(read) }217; CGSCC: attributes #[[ATTR7]] = { nofree nounwind memory(read) }218; CGSCC: attributes #[[ATTR8]] = { nofree }219; CGSCC: attributes #[[ATTR9]] = { nofree nosync willreturn }220; CGSCC: attributes #[[ATTR10]] = { nofree nounwind willreturn }221;.222;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:223; CHECK: {{.*}}224