summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-04-25 05:49:09 +0000
committerChris Lattner <sabre@nondot.org>2007-04-25 05:49:09 +0000
commit1a34b7bf9ac21ab3e497dcb3be3f1485c80780dc (patch)
tree4dbebf6b81a944cc13754dd806f053d2e2260497
parenta10b29b84b63c448b7cb423598d3a38b0f55cddb (diff)
downloadllvm-1a34b7bf9ac21ab3e497dcb3be3f1485c80780dc.tar.gz
llvm-1a34b7bf9ac21ab3e497dcb3be3f1485c80780dc.tar.bz2
llvm-1a34b7bf9ac21ab3e497dcb3be3f1485c80780dc.tar.xz
simplify some code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36427 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/VMCore/Function.cpp7
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;
}