107 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,CGSCC4target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"5target triple = "amdgcn-amd-amdhsa"6 7@G = external dso_local addrspace(4) global i32, align 48 9declare ptr @ptr() memory(none)10declare ptr addrspace(4) @ptr_to_const() memory(none)11declare ptr addrspace(3) @ptr_to_shared() memory(none)12 13; Should be memory(none)14;.15; CHECK: @G = external dso_local addrspace(4) global i32, align 416;.17define i32 @test_const_as_global1() {18; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)19; CHECK-LABEL: define {{[^@]+}}@test_const_as_global120; CHECK-SAME: () #[[ATTR1:[0-9]+]] {21; CHECK-NEXT: [[L1:%.*]] = load i32, ptr addrspace(4) @G, align 422; CHECK-NEXT: ret i32 [[L1]]23;24 %l1 = load i32, ptr addrspace(4) @G25 ret i32 %l126}27; Should be memory(none)28define i32 @test_const_as_global2() {29; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)30; CHECK-LABEL: define {{[^@]+}}@test_const_as_global231; CHECK-SAME: () #[[ATTR1]] {32; CHECK-NEXT: [[L2:%.*]] = load i32, ptr addrspace(4) @G, align 433; CHECK-NEXT: ret i32 [[L2]]34;35 %l2 = load i32, ptr addrspacecast (ptr addrspace(4) @G to ptr)36 ret i32 %l237}38; Should be memory(none)39define i32 @test_const_as_call1() {40; CHECK: Function Attrs: nosync memory(read)41; CHECK-LABEL: define {{[^@]+}}@test_const_as_call142; CHECK-SAME: () #[[ATTR2:[0-9]+]] {43; CHECK-NEXT: [[P1:%.*]] = call ptr addrspace(4) @ptr_to_const() #[[ATTR4:[0-9]+]]44; CHECK-NEXT: [[L1:%.*]] = load i32, ptr addrspace(4) [[P1]], align 445; CHECK-NEXT: ret i32 [[L1]]46;47 %p1 = call ptr addrspace(4) @ptr_to_const()48 %c1 = addrspacecast ptr addrspace(4) %p1 to ptr49 %l1 = load i32, ptr %c150 ret i32 %l151}52; Should be memory(none)53define i32 @test_const_as_call2() {54; CHECK: Function Attrs: nosync memory(none)55; CHECK-LABEL: define {{[^@]+}}@test_const_as_call256; CHECK-SAME: () #[[ATTR3:[0-9]+]] {57; CHECK-NEXT: [[P2:%.*]] = call ptr @ptr() #[[ATTR4]]58; CHECK-NEXT: [[C2:%.*]] = addrspacecast ptr [[P2]] to ptr addrspace(4)59; CHECK-NEXT: [[L2:%.*]] = load i32, ptr addrspace(4) [[C2]], align 460; CHECK-NEXT: ret i32 [[L2]]61;62 %p2 = call ptr @ptr()63 %c2 = addrspacecast ptr %p2 to ptr addrspace(4)64 %l2 = load i32, ptr addrspace(4) %c265 ret i32 %l266}67 68; Should be memory(read)69define i32 @test_shared_as_call1() {70; CHECK: Function Attrs: nosync memory(read)71; CHECK-LABEL: define {{[^@]+}}@test_shared_as_call172; CHECK-SAME: () #[[ATTR2]] {73; CHECK-NEXT: [[P1:%.*]] = call ptr addrspace(3) @ptr_to_shared() #[[ATTR4]]74; CHECK-NEXT: [[L1:%.*]] = load i32, ptr addrspace(3) [[P1]], align 475; CHECK-NEXT: ret i32 [[L1]]76;77 %p1 = call ptr addrspace(3) @ptr_to_shared()78 %c1 = addrspacecast ptr addrspace(3) %p1 to ptr79 %l1 = load i32, ptr %c180 ret i32 %l181}82; Should be memory(read)83define i32 @test_shared_as_call2() {84; CHECK: Function Attrs: nosync memory(read)85; CHECK-LABEL: define {{[^@]+}}@test_shared_as_call286; CHECK-SAME: () #[[ATTR2]] {87; CHECK-NEXT: [[P2:%.*]] = call ptr @ptr() #[[ATTR4]]88; CHECK-NEXT: [[C2:%.*]] = addrspacecast ptr [[P2]] to ptr addrspace(3)89; CHECK-NEXT: [[L2:%.*]] = load i32, ptr addrspace(3) [[C2]], align 490; CHECK-NEXT: ret i32 [[L2]]91;92 %p2 = call ptr @ptr()93 %c2 = addrspacecast ptr %p2 to ptr addrspace(3)94 %l2 = load i32, ptr addrspace(3) %c295 ret i32 %l296}97;.98; CHECK: attributes #[[ATTR0:[0-9]+]] = { memory(none) }99; CHECK: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }100; CHECK: attributes #[[ATTR2]] = { nosync memory(read) }101; CHECK: attributes #[[ATTR3]] = { nosync memory(none) }102; CHECK: attributes #[[ATTR4]] = { nosync }103;.104;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:105; CGSCC: {{.*}}106; TUNIT: {{.*}}107