diff options
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index e5f971f..37cd4ca 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -6713,11 +6713,11 @@ static bool isSameUnderlyingObjectInLoop(const PHINode *PN, } const Value *llvm::getUnderlyingObject(const Value *V, unsigned MaxLookup) { - if (!V->getType()->isPointerTy()) - return V; for (unsigned Count = 0; MaxLookup == 0 || Count < MaxLookup; ++Count) { if (auto *GEP = dyn_cast<GEPOperator>(V)) { V = GEP->getPointerOperand(); + if (!V->getType()->isPointerTy()) // Only handle scalar pointer base. + return nullptr; } else if (Operator::getOpcode(V) == Instruction::BitCast || Operator::getOpcode(V) == Instruction::AddrSpaceCast) { Value *NewV = cast<Operator>(V)->getOperand(0); |