aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ConstantFolding.cpp
diff options
context:
space:
mode:
authorManuel Jacob <me@manueljacob.de>2016-01-21 17:36:14 +0000
committerManuel Jacob <me@manueljacob.de>2016-01-21 17:36:14 +0000
commitf3ee254bc2b63f0743d83776a8a3420818f5f906 (patch)
tree13b48b089b812d9e36912fa45cfa555371c02da1 /llvm/lib/Analysis/ConstantFolding.cpp
parent82e0f15f86fe2e37317fef23848dd503d9d09e16 (diff)
downloadllvm-f3ee254bc2b63f0743d83776a8a3420818f5f906.zip
llvm-f3ee254bc2b63f0743d83776a8a3420818f5f906.tar.gz
llvm-f3ee254bc2b63f0743d83776a8a3420818f5f906.tar.bz2
Undo r258163 "Move part of an if condition into an assertion. NFC."
This undoes the change made in r258163. The assertion fails if `Ptr` is of a vector type. The previous code doesn't look completely correct either, so I'll investigate this more. llvm-svn: 258411
Diffstat (limited to 'llvm/lib/Analysis/ConstantFolding.cpp')
-rw-r--r--llvm/lib/Analysis/ConstantFolding.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp
index a69521ab..bcfdf4b 100644
--- a/llvm/lib/Analysis/ConstantFolding.cpp
+++ b/llvm/lib/Analysis/ConstantFolding.cpp
@@ -731,8 +731,8 @@ static Constant *SymbolicallyEvaluateGEP(Type *SrcTy, ArrayRef<Constant *> Ops,
Type *ResultTy, const DataLayout &DL,
const TargetLibraryInfo *TLI) {
Constant *Ptr = Ops[0];
- assert(Ptr->getType()->isPointerTy());
- if (!Ptr->getType()->getPointerElementType()->isSized())
+ if (!Ptr->getType()->getPointerElementType()->isSized() ||
+ !Ptr->getType()->isPointerTy())
return nullptr;
Type *IntPtrTy = DL.getIntPtrType(Ptr->getType());