Fix CodeGen/SparcV9/2005-05-09-GEP-Crash.ll a crash on some specfp program
authorChris Lattner <sabre@nondot.org>
Sat, 9 Apr 2005 06:27:14 +0000 (06:27 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 9 Apr 2005 06:27:14 +0000 (06:27 +0000)
lets hope this doesn't break other programs with induced entropy

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21174 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/SparcV9/SparcV9BurgISel.cpp

index f7dcb680cd6a241c9708d6e4c453ff9b7ae8b90f..ca8b5b9845c81bd557344850f2b32aa15be556bb 100644 (file)
@@ -1738,7 +1738,7 @@ static Value *GetGEPInstArgs(InstructionNode *gepNode,
   // in this and any preceding GetElemPtr instructions.
   bool foldedGEPs = false;
   bool leadingNonZeroIdx = gepI && ! IsZero(*gepI->idx_begin());
-  if (allConstantIndices)
+  if (allConstantIndices && !leadingNonZeroIdx)
     if (Value* newPtr = FoldGetElemChain(ptrChild, idxVec, leadingNonZeroIdx)) {
       ptrVal = newPtr;
       foldedGEPs = true;