From c5fce690316703b619c05e875c51a04b0ea0d547 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Thu, 28 Apr 2016 18:38:48 +0000 Subject: 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 --- llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'llvm/lib') 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 &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); -- cgit v1.2.3