summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorDavide Italiano <davide@freebsd.org>2017-04-19 14:23:42 +0000
committerDavide Italiano <davide@freebsd.org>2017-04-19 14:23:42 +0000
commita9f047a594b363768d631954b241542901ddc1eb (patch)
treeba96322cb8eafc24962c48877214a2bf8c6a951e /llvm/lib/Analysis
parentbb7e8d2ec4ba8e240d0ed23e5732e3be06c01a02 (diff)
downloadbcm5719-llvm-a9f047a594b363768d631954b241542901ddc1eb.tar.gz
bcm5719-llvm-a9f047a594b363768d631954b241542901ddc1eb.zip
[InstSimplify] Deduce correct type for vector GEP.
InstSimplify returned the wrong type when simplifying a vector GEP and we ended up crashing when trying to replace all uses with the new value. Fixes PR32697. Differential Revision: https://reviews.llvm.org/D32180 llvm-svn: 300693
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/InstructionSimplify.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index 3ec79c73d2b..5265fe0b201 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -3796,6 +3796,8 @@ static Value *SimplifyGEPInst(Type *SrcTy, ArrayRef<Value *> Ops,
Type *GEPTy = PointerType::get(LastType, AS);
if (VectorType *VT = dyn_cast<VectorType>(Ops[0]->getType()))
GEPTy = VectorType::get(GEPTy, VT->getNumElements());
+ else if (VectorType *VT = dyn_cast<VectorType>(Ops[1]->getType()))
+ GEPTy = VectorType::get(GEPTy, VT->getNumElements());
if (isa<UndefValue>(Ops[0]))
return UndefValue::get(GEPTy);
OpenPOWER on IntegriCloud