Index: test/CodeGen/AMDGPU/ipra.ll =================================================================== --- test/CodeGen/AMDGPU/ipra.ll +++ test/CodeGen/AMDGPU/ipra.ll @@ -1,4 +1,4 @@ -; RUN: llc -mtriple=amdgcn-amd-amdhsa -verify-machineinstrs -enable-ipra < %s | FileCheck -check-prefix=GCN %s +; RUN: llc -mtriple=amdgcn-amd-amdhsa -verify-machineinstrs -enable-ipra -amdgpu-sroa=0 < %s | FileCheck -check-prefix=GCN %s ; Kernels are not called, so there is no call preserved mask. ; GCN-LABEL: {{^}}kernel: @@ -9,4 +9,60 @@ ret void } -attributes #0 = { nounwind } +; GCN-LABEL: {{^}}func: +define internal void @func() #1 { + call void asm sideeffect "", "~{v0},~{v1},~{v2},~{v3},~{v4},~{v5},~{v6},~{v7}"() #0 + ret void +} + +; GCN-LABEL: {{^}}kernel_call: +; GCN-NOT: buffer_store +; GCN-NOT: buffer_load +; GCN-NOT: readlane +; GCN-NOT: writelane +; GCN: flat_load_dword v8 +; GCN: s_swappc_b64 +; GCN-NOT: buffer_store +; GCN-NOT: buffer_load +; GCN-NOT: readlane +; GCN-NOT: writelane +; GCN: flat_store_dword v{{\[[0-9]+:[0-9]+\]}}, v8 +define amdgpu_kernel void @kernel_call() #0 { + %vgpr = load volatile i32, i32 addrspace(1)* undef + call void @func() + store volatile i32 %vgpr, i32 addrspace(1)* undef + ret void +} + +; GCN-LABEL: {{^}}func_regular_call: +; GCN-NOT: buffer_store +; GCN-NOT: buffer_load +; GCN-NOT: readlane +; GCN-NOT: writelane +; GCN: flat_load_dword v8 +; GCN: s_swappc_b64 +; GCN-NOT: buffer_store +; GCN-NOT: buffer_load +; GCN-NOT: readlane +; GCN-NOT: writelane +; GCN: flat_store_dword v{{\[[0-9]+:[0-9]+\]}}, v8 +define void @func_regular_call() #1 { + %vgpr = load volatile i32, i32 addrspace(1)* undef + call void @func() + store volatile i32 %vgpr, i32 addrspace(1)* undef + ret void +} + +; GCN-LABEL: {{^}}func_tail_call: +; GCN: s_waitcnt +; GCN-NEXT: s_getpc_b64 s[6:7] +; GCN-NEXT: s_add_u32 s6, +; GCN-NEXT: s_addc_u32 s7, +; GCN-NEXT: s_setpc_b64 s[6:7] +define void @func_tail_call() #1 { + tail call void @func() + ret void +} + +attributes #0 = { nounwind norecurse } +attributes #1 = { nounwind norecurse noinline }