1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -mtriple=amdgcn-amd-amdhsa -aa-pipeline=basic-aa,scoped-noalias-aa -passes=load-store-vectorizer -S -o - %s | FileCheck -check-prefix=SCOPE %s
3 ; RUN: opt -mtriple=amdgcn-amd-amdhsa -aa-pipeline=basic-aa -passes=load-store-vectorizer -S -o - %s | FileCheck -check-prefix=NOSCOPE %s
5 target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5"
7 ; This fails to vectorize if the !alias.scope is not used
9 define amdgpu_kernel void @vectorize_alias_scope(ptr addrspace(1) nocapture %a, ptr addrspace(1) nocapture %b, ptr addrspace(1) nocapture readonly %c) #0 {
10 ; SCOPE-LABEL: @vectorize_alias_scope(
12 ; SCOPE-NEXT: [[LD_C:%.*]] = load float, ptr addrspace(1) [[C:%.*]], align 4, !alias.scope !0
13 ; SCOPE-NEXT: store <2 x float> zeroinitializer, ptr addrspace(1) [[A:%.*]], align 4, !noalias !0
14 ; SCOPE-NEXT: store float [[LD_C]], ptr addrspace(1) [[B:%.*]], align 4, !noalias !0
15 ; SCOPE-NEXT: ret void
17 ; NOSCOPE-LABEL: @vectorize_alias_scope(
18 ; NOSCOPE-NEXT: entry:
19 ; NOSCOPE-NEXT: [[A_IDX_1:%.*]] = getelementptr inbounds float, ptr addrspace(1) [[A:%.*]], i64 1
20 ; NOSCOPE-NEXT: store float 0.000000e+00, ptr addrspace(1) [[A]], align 4, !noalias !0
21 ; NOSCOPE-NEXT: [[LD_C:%.*]] = load float, ptr addrspace(1) [[C:%.*]], align 4, !alias.scope !0
22 ; NOSCOPE-NEXT: store float 0.000000e+00, ptr addrspace(1) [[A_IDX_1]], align 4, !noalias !0
23 ; NOSCOPE-NEXT: store float [[LD_C]], ptr addrspace(1) [[B:%.*]], align 4, !noalias !0
24 ; NOSCOPE-NEXT: ret void
27 %a.idx.1 = getelementptr inbounds float, ptr addrspace(1) %a, i64 1
28 store float 0.0, ptr addrspace(1) %a, align 4, !noalias !0
29 %ld.c = load float, ptr addrspace(1) %c, align 4, !alias.scope !0
30 store float 0.0, ptr addrspace(1) %a.idx.1, align 4, !noalias !0
31 store float %ld.c, ptr addrspace(1) %b, align 4, !noalias !0
35 attributes #0 = { nounwind }
38 !1 = distinct !{!1, !2, !"some scope"}
39 !2 = distinct !{!2, !"some domain"}