448 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 5 6@x = global i32 07 8declare void @test1_1(ptr %x1_1, ptr readonly %y1_1, ...)9 10; NOTE: readonly for %y1_2 would be OK here but not for the similar situation in test13.11;12;.13; CHECK: @x = global i32 014; CHECK: @constant_mem = external dso_local constant i32, align 415;.16define void @test1_2(ptr %x1_2, ptr %y1_2, ptr %z1_2) {17; CHECK-LABEL: define {{[^@]+}}@test1_218; CHECK-SAME: (ptr [[X1_2:%.*]], ptr nofree [[Y1_2:%.*]], ptr [[Z1_2:%.*]]) {19; CHECK-NEXT: call void (ptr, ptr, ...) @test1_1(ptr [[X1_2]], ptr nofree readonly [[Y1_2]], ptr [[Z1_2]])20; CHECK-NEXT: store i32 0, ptr @x, align 421; CHECK-NEXT: ret void22;23 call void (ptr, ptr, ...) @test1_1(ptr %x1_2, ptr %y1_2, ptr %z1_2)24 store i32 0, ptr @x25 ret void26}27 28define ptr @test2(ptr %p) {29; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)30; CHECK-LABEL: define {{[^@]+}}@test231; CHECK-SAME: (ptr nofree readnone returned "no-capture-maybe-returned" [[P:%.*]]) #[[ATTR0:[0-9]+]] {32; CHECK-NEXT: store i32 0, ptr @x, align 433; CHECK-NEXT: ret ptr [[P]]34;35 store i32 0, ptr @x36 ret ptr %p37}38 39define i1 @test3(ptr %p, ptr %q) {40; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)41; CHECK-LABEL: define {{[^@]+}}@test342; CHECK-SAME: (ptr nofree readnone [[P:%.*]], ptr nofree readnone [[Q:%.*]]) #[[ATTR1:[0-9]+]] {43; CHECK-NEXT: [[A:%.*]] = icmp ult ptr [[P]], [[Q]]44; CHECK-NEXT: ret i1 [[A]]45;46 %A = icmp ult ptr %p, %q47 ret i1 %A48}49 50declare void @test4_1(ptr nocapture) readonly51 52define void @test4_2(ptr %p) {53; CHECK: Function Attrs: nosync memory(read)54; CHECK-LABEL: define {{[^@]+}}@test4_255; CHECK-SAME: (ptr readonly captures(none) [[P:%.*]]) #[[ATTR3:[0-9]+]] {56; CHECK-NEXT: call void @test4_1(ptr readonly captures(none) [[P]]) #[[ATTR3]]57; CHECK-NEXT: ret void58;59 call void @test4_1(ptr %p)60 ret void61}62 63; Missed optz'n: we could make %q readnone, but don't break test6!64define void @test5(ptr %p, ptr %q) {65; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write)66; CHECK-LABEL: define {{[^@]+}}@test567; CHECK-SAME: (ptr nofree noundef nonnull writeonly align 8 captures(none) dereferenceable(8) [[P:%.*]], ptr nofree writeonly [[Q:%.*]]) #[[ATTR4:[0-9]+]] {68; CHECK-NEXT: store ptr [[Q]], ptr [[P]], align 869; CHECK-NEXT: ret void70;71 store ptr %q, ptr %p72 ret void73}74 75declare void @test6_1()76; This is not a missed optz'n.77define void @test6_2(ptr %p, ptr %q) {78; CHECK-LABEL: define {{[^@]+}}@test6_279; CHECK-SAME: (ptr nofree noundef nonnull writeonly align 8 captures(none) dereferenceable(8) [[P:%.*]], ptr nofree [[Q:%.*]]) {80; CHECK-NEXT: store ptr [[Q]], ptr [[P]], align 881; CHECK-NEXT: call void @test6_1()82; CHECK-NEXT: ret void83;84 store ptr %q, ptr %p85 call void @test6_1()86 ret void87}88 89; inalloca parameters are always considered written90define void @test7_1(ptr inalloca(i32) %a) {91; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)92; CHECK-LABEL: define {{[^@]+}}@test7_193; CHECK-SAME: (ptr nofree nonnull writeonly inalloca(i32) captures(none) dereferenceable(4) [[A:%.*]]) #[[ATTR1]] {94; CHECK-NEXT: ret void95;96 ret void97}98 99define ptr @test8_1(ptr %p) {100; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)101; CHECK-LABEL: define {{[^@]+}}@test8_1102; CHECK-SAME: (ptr nofree readnone returned "no-capture-maybe-returned" [[P:%.*]]) #[[ATTR1]] {103; CHECK-NEXT: entry:104; CHECK-NEXT: ret ptr [[P]]105;106entry:107 ret ptr %p108}109 110define void @test8_2(ptr %p) {111; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write)112; TUNIT-LABEL: define {{[^@]+}}@test8_2113; TUNIT-SAME: (ptr nofree writeonly captures(none) [[P:%.*]]) #[[ATTR4]] {114; TUNIT-NEXT: entry:115; TUNIT-NEXT: store i32 10, ptr [[P]], align 4116; TUNIT-NEXT: ret void117;118; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(argmem: write)119; CGSCC-LABEL: define {{[^@]+}}@test8_2120; CGSCC-SAME: (ptr nofree writeonly [[P:%.*]]) #[[ATTR5:[0-9]+]] {121; CGSCC-NEXT: entry:122; CGSCC-NEXT: [[CALL:%.*]] = call align 4 ptr @test8_1(ptr noalias nofree readnone [[P]]) #[[ATTR17:[0-9]+]]123; CGSCC-NEXT: store i32 10, ptr [[CALL]], align 4124; CGSCC-NEXT: ret void125;126entry:127 %call = call ptr @test8_1(ptr %p)128 store i32 10, ptr %call, align 4129 ret void130}131 132declare void @llvm.masked.scatter.v4i32.v4p0(<4 x i32>%val, <4 x ptr>, i32, <4 x i1>)133 134; CHECK-NOT: readnone135; CHECK-NOT: readonly136define void @test9(<4 x ptr> %ptrs, <4 x i32>%val) {137; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)138; TUNIT-LABEL: define {{[^@]+}}@test9139; TUNIT-SAME: (<4 x ptr> [[PTRS:%.*]], <4 x i32> [[VAL:%.*]]) #[[ATTR0]] {140; TUNIT-NEXT: call void @llvm.masked.scatter.v4i32.v4p0(<4 x i32> [[VAL]], <4 x ptr> align 4 [[PTRS]], <4 x i1> noundef <i1 true, i1 false, i1 true, i1 false>) #[[ATTR16:[0-9]+]]141; TUNIT-NEXT: ret void142;143; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(write)144; CGSCC-LABEL: define {{[^@]+}}@test9145; CGSCC-SAME: (<4 x ptr> [[PTRS:%.*]], <4 x i32> [[VAL:%.*]]) #[[ATTR0]] {146; CGSCC-NEXT: call void @llvm.masked.scatter.v4i32.v4p0(<4 x i32> [[VAL]], <4 x ptr> align 4 [[PTRS]], <4 x i1> noundef <i1 true, i1 false, i1 true, i1 false>) #[[ATTR18:[0-9]+]]147; CGSCC-NEXT: ret void148;149 call void @llvm.masked.scatter.v4i32.v4p0(<4 x i32>%val, <4 x ptr> %ptrs, i32 4, <4 x i1><i1 true, i1 false, i1 true, i1 false>)150 ret void151}152 153declare <4 x i32> @llvm.masked.gather.v4i32.v4p0(<4 x ptr>, i32, <4 x i1>, <4 x i32>)154define <4 x i32> @test10(<4 x ptr> %ptrs) {155; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read)156; TUNIT-LABEL: define {{[^@]+}}@test10157; TUNIT-SAME: (<4 x ptr> [[PTRS:%.*]]) #[[ATTR5:[0-9]+]] {158; TUNIT-NEXT: [[RES:%.*]] = call <4 x i32> @llvm.masked.gather.v4i32.v4p0(<4 x ptr> align 4 [[PTRS]], <4 x i1> noundef <i1 true, i1 false, i1 true, i1 false>, <4 x i32> undef) #[[ATTR17:[0-9]+]]159; TUNIT-NEXT: ret <4 x i32> [[RES]]160;161; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read)162; CGSCC-LABEL: define {{[^@]+}}@test10163; CGSCC-SAME: (<4 x ptr> [[PTRS:%.*]]) #[[ATTR6:[0-9]+]] {164; CGSCC-NEXT: [[RES:%.*]] = call <4 x i32> @llvm.masked.gather.v4i32.v4p0(<4 x ptr> align 4 [[PTRS]], <4 x i1> noundef <i1 true, i1 false, i1 true, i1 false>, <4 x i32> undef) #[[ATTR19:[0-9]+]]165; CGSCC-NEXT: ret <4 x i32> [[RES]]166;167 %res = call <4 x i32> @llvm.masked.gather.v4i32.v4p0(<4 x ptr> %ptrs, i32 4, <4 x i1><i1 true, i1 false, i1 true, i1 false>, <4 x i32>undef)168 ret <4 x i32> %res169}170 171declare <4 x i32> @test11_1(<4 x ptr>) argmemonly nounwind readonly172define <4 x i32> @test11_2(<4 x ptr> %ptrs) {173; TUNIT: Function Attrs: nosync nounwind memory(argmem: read)174; TUNIT-LABEL: define {{[^@]+}}@test11_2175; TUNIT-SAME: (<4 x ptr> [[PTRS:%.*]]) #[[ATTR7:[0-9]+]] {176; TUNIT-NEXT: [[RES:%.*]] = call <4 x i32> @test11_1(<4 x ptr> [[PTRS]]) #[[ATTR13:[0-9]+]]177; TUNIT-NEXT: ret <4 x i32> [[RES]]178;179; CGSCC: Function Attrs: nosync nounwind memory(argmem: read)180; CGSCC-LABEL: define {{[^@]+}}@test11_2181; CGSCC-SAME: (<4 x ptr> [[PTRS:%.*]]) #[[ATTR8:[0-9]+]] {182; CGSCC-NEXT: [[RES:%.*]] = call <4 x i32> @test11_1(<4 x ptr> [[PTRS]]) #[[ATTR14:[0-9]+]]183; CGSCC-NEXT: ret <4 x i32> [[RES]]184;185 %res = call <4 x i32> @test11_1(<4 x ptr> %ptrs)186 ret <4 x i32> %res187}188 189declare <4 x i32> @test12_1(<4 x ptr>) argmemonly nounwind190; CHECK-NOT: readnone191define <4 x i32> @test12_2(<4 x ptr> %ptrs) {192; TUNIT: Function Attrs: nounwind memory(argmem: readwrite)193; TUNIT-LABEL: define {{[^@]+}}@test12_2194; TUNIT-SAME: (<4 x ptr> [[PTRS:%.*]]) #[[ATTR8:[0-9]+]] {195; TUNIT-NEXT: [[RES:%.*]] = call <4 x i32> @test12_1(<4 x ptr> [[PTRS]]) #[[ATTR18:[0-9]+]]196; TUNIT-NEXT: ret <4 x i32> [[RES]]197;198; CGSCC: Function Attrs: nounwind memory(argmem: readwrite)199; CGSCC-LABEL: define {{[^@]+}}@test12_2200; CGSCC-SAME: (<4 x ptr> [[PTRS:%.*]]) #[[ATTR9:[0-9]+]] {201; CGSCC-NEXT: [[RES:%.*]] = call <4 x i32> @test12_1(<4 x ptr> [[PTRS]]) #[[ATTR20:[0-9]+]]202; CGSCC-NEXT: ret <4 x i32> [[RES]]203;204 %res = call <4 x i32> @test12_1(<4 x ptr> %ptrs)205 ret <4 x i32> %res206}207 208define i32 @volatile_load(ptr %p) {209; TUNIT: Function Attrs: mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite)210; TUNIT-LABEL: define {{[^@]+}}@volatile_load211; TUNIT-SAME: (ptr nofree noundef align 4 [[P:%.*]]) #[[ATTR9:[0-9]+]] {212; TUNIT-NEXT: [[LOAD:%.*]] = load volatile i32, ptr [[P]], align 4213; TUNIT-NEXT: ret i32 [[LOAD]]214;215; CGSCC: Function Attrs: mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite)216; CGSCC-LABEL: define {{[^@]+}}@volatile_load217; CGSCC-SAME: (ptr nofree noundef align 4 [[P:%.*]]) #[[ATTR10:[0-9]+]] {218; CGSCC-NEXT: [[LOAD:%.*]] = load volatile i32, ptr [[P]], align 4219; CGSCC-NEXT: ret i32 [[LOAD]]220;221 %load = load volatile i32, ptr %p222 ret i32 %load223}224 225declare void @escape_readnone_ptr(ptr %addr, ptr readnone %ptr)226declare void @escape_readonly_ptr(ptr %addr, ptr readonly %ptr)227 228; The argument pointer %escaped_then_written cannot be marked readnone/only even229; though the only direct use, in @escape_readnone_ptr/@escape_readonly_ptr,230; is marked as readnone/only. However, the functions can write the pointer into231; %addr, causing the store to write to %escaped_then_written.232;233define void @unsound_readnone(ptr %ignored, ptr %escaped_then_written) {234; CHECK-LABEL: define {{[^@]+}}@unsound_readnone235; CHECK-SAME: (ptr nofree readnone captures(none) [[IGNORED:%.*]], ptr nofree [[ESCAPED_THEN_WRITTEN:%.*]]) {236; CHECK-NEXT: [[ADDR:%.*]] = alloca ptr, align 8237; CHECK-NEXT: call void @escape_readnone_ptr(ptr noundef nonnull align 8 dereferenceable(8) [[ADDR]], ptr noalias nofree readnone [[ESCAPED_THEN_WRITTEN]])238; CHECK-NEXT: [[ADDR_LD:%.*]] = load ptr, ptr [[ADDR]], align 8239; CHECK-NEXT: store i8 0, ptr [[ADDR_LD]], align 1240; CHECK-NEXT: ret void241;242 %addr = alloca ptr243 call void @escape_readnone_ptr(ptr %addr, ptr %escaped_then_written)244 %addr.ld = load ptr, ptr %addr245 store i8 0, ptr %addr.ld246 ret void247}248 249define void @unsound_readonly(ptr %ignored, ptr %escaped_then_written) {250; CHECK-LABEL: define {{[^@]+}}@unsound_readonly251; CHECK-SAME: (ptr nofree readnone captures(none) [[IGNORED:%.*]], ptr nofree [[ESCAPED_THEN_WRITTEN:%.*]]) {252; CHECK-NEXT: [[ADDR:%.*]] = alloca ptr, align 8253; CHECK-NEXT: call void @escape_readonly_ptr(ptr noundef nonnull align 8 dereferenceable(8) [[ADDR]], ptr nofree readonly [[ESCAPED_THEN_WRITTEN]])254; CHECK-NEXT: [[ADDR_LD:%.*]] = load ptr, ptr [[ADDR]], align 8255; CHECK-NEXT: store i8 0, ptr [[ADDR_LD]], align 1256; CHECK-NEXT: ret void257;258 %addr = alloca ptr259 call void @escape_readonly_ptr(ptr %addr, ptr %escaped_then_written)260 %addr.ld = load ptr, ptr %addr261 store i8 0, ptr %addr.ld262 ret void263}264 265; Byval but not readonly/none tests266;267;{268declare void @escape_i8(ptr %ptr)269 270define void @byval_not_readonly_1(ptr byval(i8) %written) readonly {271; CHECK: Function Attrs: nosync memory(read)272; CHECK-LABEL: define {{[^@]+}}@byval_not_readonly_1273; CHECK-SAME: (ptr noalias nonnull byval(i8) dereferenceable(1) [[WRITTEN:%.*]]) #[[ATTR3]] {274; CHECK-NEXT: call void @escape_i8(ptr nonnull dereferenceable(1) [[WRITTEN]])275; CHECK-NEXT: ret void276;277 call void @escape_i8(ptr %written)278 ret void279}280 281define void @byval_not_readonly_2(ptr byval(i8) %written) readonly {282; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)283; CHECK-LABEL: define {{[^@]+}}@byval_not_readonly_2284; CHECK-SAME: (ptr noalias nofree noundef nonnull writeonly byval(i8) captures(none) dereferenceable(1) [[WRITTEN:%.*]]) #[[ATTR1]] {285; CHECK-NEXT: store i8 0, ptr [[WRITTEN]], align 1286; CHECK-NEXT: ret void287;288 store i8 0, ptr %written289 ret void290}291 292define void @byval_not_readnone_1(ptr byval(i8) %written) readnone {293; TUNIT: Function Attrs: nosync memory(none)294; TUNIT-LABEL: define {{[^@]+}}@byval_not_readnone_1295; TUNIT-SAME: (ptr noalias nonnull byval(i8) dereferenceable(1) [[WRITTEN:%.*]]) #[[ATTR10:[0-9]+]] {296; TUNIT-NEXT: call void @escape_i8(ptr nonnull dereferenceable(1) [[WRITTEN]])297; TUNIT-NEXT: ret void298;299; CGSCC: Function Attrs: nosync memory(none)300; CGSCC-LABEL: define {{[^@]+}}@byval_not_readnone_1301; CGSCC-SAME: (ptr noalias nonnull byval(i8) dereferenceable(1) [[WRITTEN:%.*]]) #[[ATTR11:[0-9]+]] {302; CGSCC-NEXT: call void @escape_i8(ptr nonnull dereferenceable(1) [[WRITTEN]])303; CGSCC-NEXT: ret void304;305 call void @escape_i8(ptr %written)306 ret void307}308 309define void @byval_not_readnone_2(ptr byval(i8) %written) readnone {310; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)311; CHECK-LABEL: define {{[^@]+}}@byval_not_readnone_2312; CHECK-SAME: (ptr noalias nofree noundef nonnull writeonly byval(i8) captures(none) dereferenceable(1) [[WRITTEN:%.*]]) #[[ATTR1]] {313; CHECK-NEXT: store i8 0, ptr [[WRITTEN]], align 1314; CHECK-NEXT: ret void315;316 store i8 0, ptr %written317 ret void318}319 320define void @byval_no_fnarg(ptr byval(i8) %written) {321; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write)322; CHECK-LABEL: define {{[^@]+}}@byval_no_fnarg323; CHECK-SAME: (ptr noalias nofree noundef nonnull writeonly byval(i8) captures(none) dereferenceable(1) [[WRITTEN:%.*]]) #[[ATTR4]] {324; CHECK-NEXT: store i8 0, ptr [[WRITTEN]], align 1325; CHECK-NEXT: ret void326;327 store i8 0, ptr %written328 ret void329}330 331define void @testbyval(ptr %read_only) {332; TUNIT: Function Attrs: nosync333; TUNIT-LABEL: define {{[^@]+}}@testbyval334; TUNIT-SAME: (ptr nonnull readonly captures(none) [[READ_ONLY:%.*]]) #[[ATTR11:[0-9]+]] {335; TUNIT-NEXT: call void @byval_not_readonly_1(ptr noalias nonnull readonly byval(i8) captures(none) [[READ_ONLY]]) #[[ATTR3]]336; TUNIT-NEXT: call void @byval_not_readnone_1(ptr noalias nonnull readnone byval(i8) captures(none) [[READ_ONLY]]) #[[ATTR11]]337; TUNIT-NEXT: call void @byval_no_fnarg(ptr noalias nofree noundef nonnull readonly byval(i8) captures(none) [[READ_ONLY]]) #[[ATTR19:[0-9]+]]338; TUNIT-NEXT: ret void339;340; CGSCC: Function Attrs: nosync341; CGSCC-LABEL: define {{[^@]+}}@testbyval342; CGSCC-SAME: (ptr noundef nonnull readonly captures(none) dereferenceable(1) [[READ_ONLY:%.*]]) #[[ATTR12:[0-9]+]] {343; CGSCC-NEXT: call void @byval_not_readonly_1(ptr noalias noundef nonnull readonly byval(i8) captures(none) dereferenceable(1) [[READ_ONLY]]) #[[ATTR2:[0-9]+]]344; CGSCC-NEXT: call void @byval_not_readnone_1(ptr noalias noundef nonnull readnone byval(i8) captures(none) dereferenceable(1) [[READ_ONLY]]) #[[ATTR12]]345; CGSCC-NEXT: call void @byval_no_fnarg(ptr noalias nofree noundef nonnull readnone byval(i8) captures(none) dereferenceable(1) [[READ_ONLY]]) #[[ATTR21:[0-9]+]]346; CGSCC-NEXT: ret void347;348 call void @byval_not_readonly_1(ptr byval(i8) %read_only)349 call void @byval_not_readonly_2(ptr byval(i8) %read_only)350 call void @byval_not_readnone_1(ptr byval(i8) %read_only)351 call void @byval_not_readnone_2(ptr byval(i8) %read_only)352 call void @byval_no_fnarg(ptr byval(i8) %read_only)353 ret void354}355;}356 357declare ptr @maybe_returned_ptr(ptr readonly %ptr) readonly nounwind358declare i8 @maybe_returned_val(ptr %ptr) readonly nounwind359declare void @val_use(i8 %ptr) readonly nounwind360 361define void @ptr_uses(ptr %ptr) {362; TUNIT: Function Attrs: nosync nounwind memory(read)363; TUNIT-LABEL: define {{[^@]+}}@ptr_uses364; TUNIT-SAME: (ptr nofree readonly captures(none) [[PTR:%.*]]) #[[ATTR13]] {365; TUNIT-NEXT: [[CALL_PTR:%.*]] = call ptr @maybe_returned_ptr(ptr nofree readonly [[PTR]]) #[[ATTR13]]366; TUNIT-NEXT: [[CALL_VAL:%.*]] = call i8 @maybe_returned_val(ptr readonly [[CALL_PTR]]) #[[ATTR13]]367; TUNIT-NEXT: ret void368;369; CGSCC: Function Attrs: nosync nounwind memory(read)370; CGSCC-LABEL: define {{[^@]+}}@ptr_uses371; CGSCC-SAME: (ptr nofree readonly captures(none) [[PTR:%.*]]) #[[ATTR14]] {372; CGSCC-NEXT: [[CALL_PTR:%.*]] = call ptr @maybe_returned_ptr(ptr nofree readonly [[PTR]]) #[[ATTR14]]373; CGSCC-NEXT: [[CALL_VAL:%.*]] = call i8 @maybe_returned_val(ptr readonly [[CALL_PTR]]) #[[ATTR14]]374; CGSCC-NEXT: ret void375;376 %call_ptr = call ptr @maybe_returned_ptr(ptr %ptr)377 %call_val = call i8 @maybe_returned_val(ptr %call_ptr)378 call void @val_use(i8 %call_val)379 ret void380}381 382define void @ptr_use_chain(ptr %ptr) {383; CHECK-LABEL: define {{[^@]+}}@ptr_use_chain384; CHECK-SAME: (ptr [[PTR:%.*]]) {385; CHECK-NEXT: call void @escape_i8(ptr [[PTR]])386; CHECK-NEXT: ret void387;388 call void @escape_i8(ptr %ptr)389 ret void390}391 392@constant_mem = external dso_local constant i32, align 4393define i32 @read_only_constant_mem() {394; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)395; CHECK-LABEL: define {{[^@]+}}@read_only_constant_mem396; CHECK-SAME: () #[[ATTR1]] {397; CHECK-NEXT: [[L:%.*]] = load i32, ptr @constant_mem, align 4398; CHECK-NEXT: ret i32 [[L]]399;400 %l = load i32, ptr @constant_mem401 ret i32 %l402}403;.404; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(write) }405; TUNIT: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }406; TUNIT: attributes #[[ATTR2:[0-9]+]] = { memory(read) }407; TUNIT: attributes #[[ATTR3]] = { nosync memory(read) }408; TUNIT: attributes #[[ATTR4]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) }409; TUNIT: attributes #[[ATTR5]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(read) }410; TUNIT: attributes #[[ATTR6:[0-9]+]] = { nounwind memory(argmem: read) }411; TUNIT: attributes #[[ATTR7]] = { nosync nounwind memory(argmem: read) }412; TUNIT: attributes #[[ATTR8]] = { nounwind memory(argmem: readwrite) }413; TUNIT: attributes #[[ATTR9]] = { mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite) }414; TUNIT: attributes #[[ATTR10]] = { nosync memory(none) }415; TUNIT: attributes #[[ATTR11]] = { nosync }416; TUNIT: attributes #[[ATTR12:[0-9]+]] = { nounwind memory(read) }417; TUNIT: attributes #[[ATTR13]] = { nosync nounwind memory(read) }418; TUNIT: attributes #[[ATTR14:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(write) }419; TUNIT: attributes #[[ATTR15:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(read) }420; TUNIT: attributes #[[ATTR16]] = { nofree willreturn memory(write) }421; TUNIT: attributes #[[ATTR17]] = { nofree willreturn memory(read) }422; TUNIT: attributes #[[ATTR18]] = { nounwind }423; TUNIT: attributes #[[ATTR19]] = { nosync nounwind memory(write) }424;.425; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(write) }426; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }427; CGSCC: attributes #[[ATTR2]] = { memory(read) }428; CGSCC: attributes #[[ATTR3]] = { nosync memory(read) }429; CGSCC: attributes #[[ATTR4]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) }430; CGSCC: attributes #[[ATTR5]] = { mustprogress nofree nosync nounwind willreturn memory(argmem: write) }431; CGSCC: attributes #[[ATTR6]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(read) }432; CGSCC: attributes #[[ATTR7:[0-9]+]] = { nounwind memory(argmem: read) }433; CGSCC: attributes #[[ATTR8]] = { nosync nounwind memory(argmem: read) }434; CGSCC: attributes #[[ATTR9]] = { nounwind memory(argmem: readwrite) }435; CGSCC: attributes #[[ATTR10]] = { mustprogress nofree norecurse nounwind willreturn memory(argmem: readwrite) }436; CGSCC: attributes #[[ATTR11]] = { nosync memory(none) }437; CGSCC: attributes #[[ATTR12]] = { nosync }438; CGSCC: attributes #[[ATTR13:[0-9]+]] = { nounwind memory(read) }439; CGSCC: attributes #[[ATTR14]] = { nosync nounwind memory(read) }440; CGSCC: attributes #[[ATTR15:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(write) }441; CGSCC: attributes #[[ATTR16:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(read) }442; CGSCC: attributes #[[ATTR17]] = { nofree nosync willreturn }443; CGSCC: attributes #[[ATTR18]] = { nofree willreturn memory(write) }444; CGSCC: attributes #[[ATTR19]] = { nofree willreturn memory(read) }445; CGSCC: attributes #[[ATTR20]] = { nounwind }446; CGSCC: attributes #[[ATTR21]] = { nounwind memory(write) }447;.448