From 950e60ea97c4f7484dce0cbb22393e6b6f64c6bb Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 2 Sep 2009 05:35:45 +0000 Subject: 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. llvm-svn: 80762 --- llvm/lib/Analysis/ConstantFolding.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/lib/Analysis/ConstantFolding.cpp') diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp index 5dcb021acf6..109eaad4584 100644 --- a/llvm/lib/Analysis/ConstantFolding.cpp +++ b/llvm/lib/Analysis/ConstantFolding.cpp @@ -172,7 +172,7 @@ static Constant *SymbolicallyEvaluateGEP(Constant* const* Ops, unsigned NumOps, do { if (const SequentialType *ATy = dyn_cast(Ty)) { // The only pointer indexing we'll do is on the first index of the GEP. - if (isa(ATy) && ATy != Ptr->getType()) + if (isa(ATy) && !NewIdxs.empty()) break; // Determine which element of the array the offset points into. APInt ElemSize(BitWidth, TD->getTypeAllocSize(ATy->getElementType())); -- cgit v1.2.3