diff options
| author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2016-04-28 18:38:48 +0000 |
|---|---|---|
| committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2016-04-28 18:38:48 +0000 |
| commit | c5fce690316703b619c05e875c51a04b0ea0d547 (patch) | |
| tree | 8c9936b0705d20760b32b9be63b93bfc2ce131c1 /llvm/lib | |
| parent | f918b004907cdd3e04d8bd487ca6487dc1c0e37b (diff) | |
| download | bcm5719-llvm-c5fce690316703b619c05e875c51a04b0ea0d547.tar.gz bcm5719-llvm-c5fce690316703b619c05e875c51a04b0ea0d547.zip | |
AMDGPU: Fix mishandling array allocations when promoting alloca
The canonical form for allocas is a single allocation of the array type.
In case we see a non-canonical array alloca, make sure we aren't
replacing this with an array N times smaller.
llvm-svn: 267916
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp b/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp index b7d30d235a0..396f01e441e 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp @@ -483,7 +483,9 @@ static bool collectUsesWithPtrTypes(Value *Val, std::vector<Value*> &WorkList) { } void AMDGPUPromoteAlloca::handleAlloca(AllocaInst &I) { - if (!I.isStaticAlloca()) + // Array allocations are probably not worth handling, since an allocation of + // the array type is the canonical form. + if (!I.isStaticAlloca() || I.isArrayAllocation()) return; IRBuilder<> Builder(&I); |

