diff options
author | Chris Lattner <sabre@nondot.org> | 2007-04-25 05:49:09 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-04-25 05:49:09 +0000 |
commit | 1a34b7bf9ac21ab3e497dcb3be3f1485c80780dc (patch) | |
tree | 4dbebf6b81a944cc13754dd806f053d2e2260497 /lib/VMCore | |
parent | a10b29b84b63c448b7cb423598d3a38b0f55cddb (diff) | |
download | external_llvm-1a34b7bf9ac21ab3e497dcb3be3f1485c80780dc.zip external_llvm-1a34b7bf9ac21ab3e497dcb3be3f1485c80780dc.tar.gz external_llvm-1a34b7bf9ac21ab3e497dcb3be3f1485c80780dc.tar.bz2 |
simplify some code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36427 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-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 e395366..8b91c18 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; } |