[PATCH] D54158: AMDGPU: Add an option -disable-promote-alloca-to-lds

Yaxun Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 6 13:30:48 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL346267: AMDGPU: Add an option -disable-promote-alloca-to-lds (authored by yaxunl, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D54158?vs=172833&id=172840#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D54158

Files:
  llvm/trunk/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
  llvm/trunk/test/CodeGen/AMDGPU/promote-alloca-to-lds-icmp.ll


Index: llvm/trunk/test/CodeGen/AMDGPU/promote-alloca-to-lds-icmp.ll
===================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/promote-alloca-to-lds-icmp.ll
+++ llvm/trunk/test/CodeGen/AMDGPU/promote-alloca-to-lds-icmp.ll
@@ -1,8 +1,11 @@
 ; RUN: opt -S -mtriple=amdgcn-unknown-amdhsa -mcpu=kaveri -amdgpu-promote-alloca < %s | FileCheck %s
+; RUN: opt -S -mtriple=amdgcn-unknown-amdhsa -mcpu=kaveri -amdgpu-promote-alloca -disable-promote-alloca-to-lds< %s | FileCheck -check-prefix=NOLDS %s
 
 ; This normally would be fixed by instcombine to be compare to the GEP
 ; indices
 
+; NOLDS-NOT: addrspace(3)
+
 ; CHECK-LABEL: @lds_promoted_alloca_icmp_same_derived_pointer(
 ; CHECK: [[ARRAYGEP:%[0-9]+]] = getelementptr inbounds [256 x [16 x i32]], [256 x [16 x i32]] addrspace(3)* @lds_promoted_alloca_icmp_same_derived_pointer.alloca, i32 0, i32 %{{[0-9]+}}
 ; CHECK: %ptr0 = getelementptr inbounds [16 x i32], [16 x i32] addrspace(3)* [[ARRAYGEP]], i32 0, i32 %a
Index: llvm/trunk/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
===================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
@@ -70,6 +70,11 @@
   cl::desc("Disable promote alloca to vector"),
   cl::init(false));
 
+static cl::opt<bool> DisablePromoteAllocaToLDS(
+  "disable-promote-alloca-to-lds",
+  cl::desc("Disable promote alloca to LDS"),
+  cl::init(false));
+
 // FIXME: This can create globals so should be a module pass.
 class AMDGPUPromoteAlloca : public FunctionPass {
 private:
@@ -706,6 +711,9 @@
   if (tryPromoteAllocaToVector(&I))
     return true; // Promoted to vector.
 
+  if (DisablePromoteAllocaToLDS)
+    return false;
+
   const Function &ContainingFunction = *I.getParent()->getParent();
   CallingConv::ID CC = ContainingFunction.getCallingConv();
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54158.172840.patch
Type: text/x-patch
Size: 1908 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181106/0e087234/attachment.bin>


More information about the llvm-commits mailing list