aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/ConstantFolding.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-09-02 05:35:45 +0000
committerChris Lattner <sabre@nondot.org>2009-09-02 05:35:45 +0000
commitf19f9347b85279100f7d549154e37b6d726c3c94 (patch)
treedb74b60eface483db794885f33c201e27dd71948 /lib/Analysis/ConstantFolding.cpp
parent9e17b632ec7fdd150a2f08ed4b661011ed47dcfa (diff)
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
Diffstat (limited to 'lib/Analysis/ConstantFolding.cpp')
-rw-r--r--lib/Analysis/ConstantFolding.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Analysis/ConstantFolding.cpp b/lib/Analysis/ConstantFolding.cpp
index 5dcb021acf..109eaad458 100644
--- a/lib/Analysis/ConstantFolding.cpp
+++ b/lib/Analysis/ConstantFolding.cpp
@@ -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()));