[llvm-branch-commits] [llvm-branch] r81028 - in /llvm/branches/release_26: lib/Analysis/ConstantFolding.cpp test/Transforms/ConstProp/2009-10-01-GEP-Crash.ll

Tanya Lattner tonic at nondot.org
Fri Sep 4 12:24:58 PDT 2009


Author: tbrethou
Date: Fri Sep  4 14:24:58 2009
New Revision: 81028

URL: http://llvm.org/viewvc/llvm-project?rev=81028&view=rev
Log:
Merge 80762 from mainline.
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.

Added:
    llvm/branches/release_26/test/Transforms/ConstProp/2009-10-01-GEP-Crash.ll
      - copied unchanged from r80762, llvm/trunk/test/Transforms/ConstProp/2009-10-01-GEP-Crash.ll
Modified:
    llvm/branches/release_26/lib/Analysis/ConstantFolding.cpp

Modified: llvm/branches/release_26/lib/Analysis/ConstantFolding.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_26/lib/Analysis/ConstantFolding.cpp?rev=81028&r1=81027&r2=81028&view=diff

==============================================================================
--- llvm/branches/release_26/lib/Analysis/ConstantFolding.cpp (original)
+++ llvm/branches/release_26/lib/Analysis/ConstantFolding.cpp Fri Sep  4 14:24:58 2009
@@ -172,7 +172,7 @@
   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()));





More information about the llvm-branch-commits mailing list