brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · 748f752 Raw
50 lines · plain
1; RUN: not opt --mtriple=amdgcn --passes='lint<abort-on-error>' %s -disable-output 2>&1 | FileCheck %s2; RUN: opt --mtriple=amdgcn --mcpu=gfx1030 --passes=lint %s -disable-output 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK03; RUN: opt --mtriple=x86_64 --passes='lint<abort-on-error>' %s -disable-output 2>&1 | FileCheck %s --allow-empty --check-prefix=NOERR4; NOERR: {{^$}}5 6define amdgpu_kernel void @store_const(ptr addrspace(4) %out, i32 %a, i32 %b) {7; CHECK: Undefined behavior: Write to memory in const addrspace8; CHECK-NEXT: store i32 %r, ptr addrspace(4) %out9  %r = add i32 %a, %b10  store i32 %r, ptr addrspace(4) %out11  ret void12}13 14declare void @llvm.memset.p4.i64(ptr addrspace(4) noalias nocapture writeonly, i8, i64, i1)15define amdgpu_kernel void @memset_const(ptr addrspace(4) %dst) {16; CHECK0: Undefined behavior: Write to memory in const addrspace17; CHECK0-NEXT: call void @llvm.memset.p4.i64(ptr addrspace(4) %dst, i8 0, i64 256, i1 false)18  call void @llvm.memset.p4.i64(ptr addrspace(4) %dst, i8 0, i64 256, i1 false)19  ret void20}21 22declare void @llvm.memcpy.p6.p0.i32(ptr addrspace(6) noalias nocapture writeonly, ptr noalias nocapture readonly, i32, i1)23define amdgpu_kernel void @memcpy_to_const(ptr addrspace(6) %dst, ptr %src) {24; CHECK0: Undefined behavior: Write to memory in const addrspace25; CHECK0-NEXT: call void @llvm.memcpy.p6.p0.i32(ptr addrspace(6) %dst, ptr %src, i32 256, i1 false)26  call void @llvm.memcpy.p6.p0.i32(ptr addrspace(6) %dst, ptr %src, i32 256, i1 false)27  ret void28}29 30define amdgpu_kernel void @cmpxchg_to_const(ptr addrspace(4) %dst, i32 %src) {31; CHECK0: Undefined behavior: Write to memory in const addrspace32; CHECK0-NEXT: %void = cmpxchg ptr addrspace(4) %dst, i32 0, i32 %src seq_cst monotonic33  %void = cmpxchg ptr addrspace(4) %dst, i32 0, i32 %src seq_cst monotonic34  ret void35}36 37define amdgpu_kernel void @atomicrmw_to_const(ptr addrspace(4) %dst, i32 %src) {38; CHECK0: Undefined behavior: Write to memory in const addrspace39; CHECK0-NEXT: %void = atomicrmw add ptr addrspace(4) %dst, i32 %src acquire40  %void = atomicrmw add ptr addrspace(4) %dst, i32 %src acquire41  ret void42}43 44declare void @const_param(ptr addrspace(6))45define amdgpu_kernel void @call_with_const(ptr addrspace(6) %dst) {46; CHECK0-NOT: call void @const_param(ptr addrspace(6) %dst)47  call void @const_param(ptr addrspace(6) %dst)48  ret void49}50