1; RUN: opt -S -mtriple=amdgcn-unknown-amdhsa -amdgpu-promote-alloca < %s | FileCheck %s 2 3; CHECK-LABEL: @volatile_load( 4; CHECK: alloca [4 x i32] 5; CHECK: load volatile i32, i32* 6define amdgpu_kernel void @volatile_load(i32 addrspace(1)* nocapture %out, i32 addrspace(1)* nocapture %in) { 7entry: 8 %stack = alloca [4 x i32], align 4 9 %tmp = load i32, i32 addrspace(1)* %in, align 4 10 %arrayidx1 = getelementptr inbounds [4 x i32], [4 x i32]* %stack, i32 0, i32 %tmp 11 %load = load volatile i32, i32* %arrayidx1 12 store i32 %load, i32 addrspace(1)* %out 13 ret void 14} 15 16; CHECK-LABEL: @volatile_store( 17; CHECK: alloca [4 x i32] 18; CHECK: store volatile i32 %tmp, i32* 19define amdgpu_kernel void @volatile_store(i32 addrspace(1)* nocapture %out, i32 addrspace(1)* nocapture %in) { 20entry: 21 %stack = alloca [4 x i32], align 4 22 %tmp = load i32, i32 addrspace(1)* %in, align 4 23 %arrayidx1 = getelementptr inbounds [4 x i32], [4 x i32]* %stack, i32 0, i32 %tmp 24 store volatile i32 %tmp, i32* %arrayidx1 25 ret void 26} 27 28; Has on OK non-volatile user but also a volatile user 29; CHECK-LABEL: @volatile_and_non_volatile_load( 30; CHECK: alloca double 31; CHECK: load double 32; CHECK: load volatile double 33define amdgpu_kernel void @volatile_and_non_volatile_load(double addrspace(1)* nocapture %arg, i32 %arg1) #0 { 34bb: 35 %tmp = alloca double, align 8 36 store double 0.000000e+00, double* %tmp, align 8 37 38 %tmp4 = load double, double* %tmp, align 8 39 %tmp5 = load volatile double, double* %tmp, align 8 40 41 store double %tmp4, double addrspace(1)* %arg 42 ret void 43} 44 45attributes #0 = { nounwind } 46