brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · bf4e02d Raw
38 lines · plain
1; RUN: opt -S -mtriple=amdgcn-unknown-amdhsa -mcpu=kaveri -passes=amdgpu-promote-alloca < %s | FileCheck %s2 3; The types of the users of the addrspacecast should not be changed.4 5; CHECK-LABEL: @invalid_bitcast_addrspace(6; CHECK: alloca7; CHECK: addrspacecast8; CHECK: load9; CHECK: bitcast10define amdgpu_kernel void @invalid_bitcast_addrspace() #0 {11entry:12  %data = alloca [1 x i32], addrspace(5)13  %tmp1 = addrspacecast ptr addrspace(5) %data to ptr14  %tmp3 = load <2 x i16>, ptr %tmp1, align 215  %tmp4 = bitcast <2 x i16> %tmp3 to <2 x half>16  ret void17}18 19; A callee use is not promotable even if it has a nocapture attribute.20define void @nocapture_callee(ptr nocapture noundef writeonly %flat.observes.addrspace) #0 {21  %private.ptr = addrspacecast ptr %flat.observes.addrspace to ptr addrspace(5)22  store i32 1, ptr addrspace(5) %private.ptr, align 423  ret void24}25 26; CHECK-LABEL: @kernel_call_nocapture(27; CHECK: alloca i3228; CHECK-NEXT: addrspacecast29; CHECK-NEXT: call30define amdgpu_kernel void @kernel_call_nocapture() #0 {31  %alloca = alloca i32, align 4, addrspace(5)32  %flat.alloca = addrspacecast ptr addrspace(5) %alloca to ptr33  call void @nocapture_callee(ptr noundef %flat.alloca)34  ret void35}36 37attributes #0 = { nounwind "amdgpu-flat-work-group-size"="1,256" }38