diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2018-03-16 17:50:44 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2018-03-16 17:50:44 +0000 | 
| commit | 077d36ae021ca14b90042db269fb241024c20a5d (patch) | |
| tree | 77447dafe27c44f242260e4a4d9cf35ce5dda4e2 /contrib/llvm/lib/Analysis/InstructionSimplify.cpp | |
| parent | 29c29cbb402cc017f0724a13fa1a586bb51d3732 (diff) | |
Notes
Diffstat (limited to 'contrib/llvm/lib/Analysis/InstructionSimplify.cpp')
| -rw-r--r-- | contrib/llvm/lib/Analysis/InstructionSimplify.cpp | 4 | 
1 files changed, 2 insertions, 2 deletions
| diff --git a/contrib/llvm/lib/Analysis/InstructionSimplify.cpp b/contrib/llvm/lib/Analysis/InstructionSimplify.cpp index f382a1f50188..c814ff122e44 100644 --- a/contrib/llvm/lib/Analysis/InstructionSimplify.cpp +++ b/contrib/llvm/lib/Analysis/InstructionSimplify.cpp @@ -3697,7 +3697,7 @@ static Value *SimplifyGEPInst(Type *SrcTy, ArrayRef<Value *> Ops,    if (Ops.size() == 2) {      // getelementptr P, 0 -> P. -    if (match(Ops[1], m_Zero())) +    if (match(Ops[1], m_Zero()) && Ops[0]->getType() == GEPTy)        return Ops[0];      Type *Ty = SrcTy; @@ -3706,7 +3706,7 @@ static Value *SimplifyGEPInst(Type *SrcTy, ArrayRef<Value *> Ops,        uint64_t C;        uint64_t TyAllocSize = Q.DL.getTypeAllocSize(Ty);        // getelementptr P, N -> P if P points to a type of zero size. -      if (TyAllocSize == 0) +      if (TyAllocSize == 0 && Ops[0]->getType() == GEPTy)          return Ops[0];        // The following transforms are only safe if the ptrtoint cast | 
