diff options
author | Chris Lattner <sabre@nondot.org> | 2009-09-02 05:35:45 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-09-02 05:35:45 +0000 |
commit | 950e60ea97c4f7484dce0cbb22393e6b6f64c6bb (patch) | |
tree | 5b7fc1a29d716ad8f56753f1b7919db7d226f77a /llvm/lib/Analysis/ConstantFolding.cpp | |
parent | 64b5842986bff8a4739cd377c9cb35ada1bf851b (diff) | |
download | bcm5719-llvm-950e60ea97c4f7484dce0cbb22393e6b6f64c6bb.tar.gz bcm5719-llvm-950e60ea97c4f7484dce0cbb22393e6b6f64c6bb.zip |
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
Diffstat (limited to 'llvm/lib/Analysis/ConstantFolding.cpp')
-rw-r--r-- | llvm/lib/Analysis/ConstantFolding.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
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<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())); |