summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/R600/AMDGPUPromoteAlloca.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Target/R600/AMDGPUPromoteAlloca.cpp')
-rw-r--r--llvm/lib/Target/R600/AMDGPUPromoteAlloca.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/Target/R600/AMDGPUPromoteAlloca.cpp b/llvm/lib/Target/R600/AMDGPUPromoteAlloca.cpp
index 4a6c10455df..8e85b03d4eb 100644
--- a/llvm/lib/Target/R600/AMDGPUPromoteAlloca.cpp
+++ b/llvm/lib/Target/R600/AMDGPUPromoteAlloca.cpp
@@ -105,14 +105,16 @@ static VectorType *arrayTypeToVecType(const Type *ArrayTy) {
ArrayTy->getArrayNumElements());
}
-static Value* calculateVectorIndex(Value *Ptr,
- std::map<GetElementPtrInst*, Value*> GEPIdx) {
+static Value *
+calculateVectorIndex(Value *Ptr,
+ const std::map<GetElementPtrInst *, Value *> &GEPIdx) {
if (isa<AllocaInst>(Ptr))
return Constant::getNullValue(Type::getInt32Ty(Ptr->getContext()));
GetElementPtrInst *GEP = cast<GetElementPtrInst>(Ptr);
- return GEPIdx[GEP];
+ auto I = GEPIdx.find(GEP);
+ return I == GEPIdx.end() ? nullptr : I->second;
}
static Value* GEPToVectorIndex(GetElementPtrInst *GEP) {
OpenPOWER on IntegriCloud