diff options
Diffstat (limited to 'lib/VMCore/Function.cpp')
-rw-r--r-- | lib/VMCore/Function.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp index e395366803..8b91c18fff 100644 --- a/lib/VMCore/Function.cpp +++ b/lib/VMCore/Function.cpp @@ -307,11 +307,8 @@ Value *IntrinsicInst::StripPointerCasts(Value *Ptr) { if (isa<PointerType>(CI->getOperand(0)->getType())) return StripPointerCasts(CI->getOperand(0)); } else if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(Ptr)) { - for (unsigned i = 1, e = GEP->getNumOperands(); i != e; ++i) - if (!isa<Constant>(GEP->getOperand(i)) || - !cast<Constant>(GEP->getOperand(i))->isNullValue()) - return Ptr; - return StripPointerCasts(GEP->getOperand(0)); + if (GEP->hasAllZeroIndices()) + return StripPointerCasts(GEP->getOperand(0)); } return Ptr; } |