simplify some code

llvm-svn: 36427
This commit is contained in:
Chris Lattner 2007-04-25 05:49:09 +00:00
parent 31e5addb67
commit bbe9b8a12f
1 changed files with 2 additions and 5 deletions

View File

@ -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;
}