[PATCH] D36697: IPRA: Don't assume called function is first call operand

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 14 10:35:14 PDT 2017


arsenm updated this revision to Diff 111032.
arsenm added a comment.
Herald added a subscriber: nhaehnle.

Add tests


https://reviews.llvm.org/D36697

Files:
  test/CodeGen/AMDGPU/ipra.ll


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 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36697.111032.patch
Type: text/x-patch
Size: 2096 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170814/f2eab00a/attachment.bin>


More information about the llvm-commits mailing list