fix PR4848 an infinite loop when indexing down through a recursive gep

and we get the original pointer type.  This doesn't mean that we're
at the first pointer being indexed.  Correct the predicate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80762 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2009-09-02 05:35:45 +00:00
parent 9e17b632ec
commit f19f9347b8
2 changed files with 25 additions and 1 deletions

View File

@@ -172,7 +172,7 @@ static Constant *SymbolicallyEvaluateGEP(Constant* const* Ops, unsigned NumOps,
do {
if (const SequentialType *ATy = dyn_cast<SequentialType>(Ty)) {
// The only pointer indexing we'll do is on the first index of the GEP.
if (isa<PointerType>(ATy) && ATy != Ptr->getType())
if (isa<PointerType>(ATy) && !NewIdxs.empty())
break;
// Determine which element of the array the offset points into.
APInt ElemSize(BitWidth, TD->getTypeAllocSize(ATy->getElementType()));