diff options
| author | Yaxun Liu <Yaxun.Liu@amd.com> | 2018-11-06 21:28:17 +0000 |
|---|---|---|
| committer | Yaxun Liu <Yaxun.Liu@amd.com> | 2018-11-06 21:28:17 +0000 |
| commit | 73bf0af32f7356cbeb22919ac21deff1c4b30855 (patch) | |
| tree | 511e0b61c18c689f428ef628f088b7fd827d97ec | |
| parent | f3869cd14d93b72bb9799af614d2b38fff0f0ff8 (diff) | |
| download | bcm5719-llvm-73bf0af32f7356cbeb22919ac21deff1c4b30855.tar.gz bcm5719-llvm-73bf0af32f7356cbeb22919ac21deff1c4b30855.zip | |
AMDGPU: Add an option -disable-promote-alloca-to-lds
Add this option for debugging and providing workaround.
By default it is off so no behavior change in backend.
Differential Revision: https://reviews.llvm.org/D54158
llvm-svn: 346267
| -rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp | 8 | ||||
| -rw-r--r-- | llvm/test/CodeGen/AMDGPU/promote-alloca-to-lds-icmp.ll | 3 |
2 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp b/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp index fe9e4ca0ca4..ec7ea2baec0 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp @@ -70,6 +70,11 @@ static cl::opt<bool> DisablePromoteAllocaToVector( 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 @@ bool AMDGPUPromoteAlloca::handleAlloca(AllocaInst &I, bool SufficientLDS) { if (tryPromoteAllocaToVector(&I)) return true; // Promoted to vector. + if (DisablePromoteAllocaToLDS) + return false; + const Function &ContainingFunction = *I.getParent()->getParent(); CallingConv::ID CC = ContainingFunction.getCallingConv(); diff --git a/llvm/test/CodeGen/AMDGPU/promote-alloca-to-lds-icmp.ll b/llvm/test/CodeGen/AMDGPU/promote-alloca-to-lds-icmp.ll index ebef6122990..8d12a725594 100644 --- a/llvm/test/CodeGen/AMDGPU/promote-alloca-to-lds-icmp.ll +++ b/llvm/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 |

