summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp')
-rw-r--r--gnu/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/gnu/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp b/gnu/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
index 625c9b77e2d..41876ed45c8 100644
--- a/gnu/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
+++ b/gnu/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
@@ -285,9 +285,9 @@ Value *AMDGPUPromoteAlloca::getWorkitemID(IRBuilder<> &Builder, unsigned N) {
return CI;
}
-static VectorType *arrayTypeToVecType(Type *ArrayTy) {
- return VectorType::get(ArrayTy->getArrayElementType(),
- ArrayTy->getArrayNumElements());
+static VectorType *arrayTypeToVecType(ArrayType *ArrayTy) {
+ return VectorType::get(ArrayTy->getElementType(),
+ ArrayTy->getNumElements());
}
static Value *
@@ -346,10 +346,9 @@ static bool tryPromoteAllocaToVector(AllocaInst *Alloca, AMDGPUAS AS) {
// FIXME: We also reject alloca's of the form [ 2 x [ 2 x i32 ]] or equivalent. Potentially these
// could also be promoted but we don't currently handle this case
if (!AllocaTy ||
- AllocaTy->getElementType()->isVectorTy() ||
- AllocaTy->getElementType()->isArrayTy() ||
AllocaTy->getNumElements() > 4 ||
- AllocaTy->getNumElements() < 2) {
+ AllocaTy->getNumElements() < 2 ||
+ !VectorType::isValidElementType(AllocaTy->getElementType())) {
DEBUG(dbgs() << " Cannot convert type to vector\n");
return false;
}