1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -mtriple=amdgcn-amd-amdhsa -S -amdgpu-aa-wrapper -amdgpu-aa -instcombine -o - %s | FileCheck %s
4 ; Test AA::pointsToConstantMemory implementation. These should mostly
5 ; turn out to be stores to constant memory, and will therefore be
8 define void @test_constant_addrspace(ptr addrspace(4) %p) {
9 ; CHECK-LABEL: @test_constant_addrspace(
10 ; CHECK-NEXT: ret void
12 store i8 0, ptr addrspace(4) %p
16 define void @test_constant32bit_addrspace(ptr addrspace(6) %p) {
17 ; CHECK-LABEL: @test_constant32bit_addrspace(
18 ; CHECK-NEXT: ret void
20 store i8 0, ptr addrspace(6) %p
24 define void @test_cast_generic_from_constant_addrspace(ptr addrspace(4) %p) {
25 ; CHECK-LABEL: @test_cast_generic_from_constant_addrspace(
26 ; CHECK-NEXT: ret void
28 %cast = addrspacecast ptr addrspace(4) %p to ptr
33 define void @test_cast_generic_from_constant32bit_addrspace(ptr addrspace(6) %p) {
34 ; CHECK-LABEL: @test_cast_generic_from_constant32bit_addrspace(
35 ; CHECK-NEXT: ret void
37 %cast = addrspacecast ptr addrspace(6) %p to ptr
42 define void @test_cast_generic_to_constant_addrspace(ptr %p) {
43 ; CHECK-LABEL: @test_cast_generic_to_constant_addrspace(
44 ; CHECK-NEXT: ret void
46 %cast = addrspacecast ptr %p to ptr addrspace(4)
47 store i8 0, ptr addrspace(4) %cast
51 define void @test_cast_generic_to_constant32bit_addrspace(ptr %p) {
52 ; CHECK-LABEL: @test_cast_generic_to_constant32bit_addrspace(
53 ; CHECK-NEXT: ret void
55 %cast = addrspacecast ptr %p to ptr addrspace(6)
56 store i8 0, ptr addrspace(6) %cast
60 define amdgpu_kernel void @noalias_readnone_global_kernarg(ptr addrspace(1) noalias readnone %arg) {
61 ; CHECK-LABEL: @noalias_readnone_global_kernarg(
62 ; CHECK-NEXT: ret void
64 store i32 0, ptr addrspace(1) %arg
68 define amdgpu_kernel void @noalias_readonly_global_kernarg(ptr addrspace(1) noalias readonly %arg) {
69 ; CHECK-LABEL: @noalias_readonly_global_kernarg(
70 ; CHECK-NEXT: ret void
72 store i32 0, ptr addrspace(1) %arg
76 define amdgpu_kernel void @readnone_global_kernarg(ptr addrspace(1) readnone %arg) {
77 ; CHECK-LABEL: @readnone_global_kernarg(
78 ; CHECK-NEXT: store i32 0, ptr addrspace(1) [[ARG:%.*]], align 4
79 ; CHECK-NEXT: ret void
81 store i32 0, ptr addrspace(1) %arg
85 define amdgpu_kernel void @readonly_global_kernarg(ptr addrspace(1) readonly %arg) {
86 ; CHECK-LABEL: @readonly_global_kernarg(
87 ; CHECK-NEXT: store i32 0, ptr addrspace(1) [[ARG:%.*]], align 4
88 ; CHECK-NEXT: ret void
90 store i32 0, ptr addrspace(1) %arg
94 @global_as_constant = external addrspace(1) constant i32, align 4
96 define amdgpu_kernel void @constant_gv_global_as() {
97 ; CHECK-LABEL: @constant_gv_global_as(
98 ; CHECK-NEXT: ret void
100 store i32 0, ptr addrspace(1) @global_as_constant
104 @global_nonconstant_constant_as = external addrspace(4) global i32, align 4
106 define amdgpu_kernel void @nonconst_gv_constant_as() {
107 ; CHECK-LABEL: @nonconst_gv_constant_as(
108 ; CHECK-NEXT: ret void
110 store i32 0, ptr addrspace(4) @global_nonconstant_constant_as