[llvm-branch-commits] [llvm-branch] r128101 - in /llvm/branches/release_29: ./ lib/Target/ARM/ARMFastISel.cpp

Bill Wendling isanbard at gmail.com
Tue Mar 22 12:45:56 PDT 2011


Author: void
Date: Tue Mar 22 14:45:56 2011
New Revision: 128101

URL: http://llvm.org/viewvc/llvm-project?rev=128101&view=rev
Log:
--- Merging r128100 into '.':
U    lib/Target/ARM/ARMFastISel.cpp


Modified:
    llvm/branches/release_29/   (props changed)
    llvm/branches/release_29/lib/Target/ARM/ARMFastISel.cpp

Propchange: llvm/branches/release_29/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar 22 14:45:56 2011
@@ -1,2 +1,2 @@
 /llvm/branches/Apple/Pertwee:110850,110961
-/llvm/trunk:127241,127263-127264,127298,127325,127328,127350-127351,127441,127464,127780,128041
+/llvm/trunk:127241,127263-127264,127298,127325,127328,127350-127351,127441,127464,127780,128041,128100

Modified: llvm/branches/release_29/lib/Target/ARM/ARMFastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_29/lib/Target/ARM/ARMFastISel.cpp?rev=128101&r1=128100&r2=128101&view=diff
==============================================================================
--- llvm/branches/release_29/lib/Target/ARM/ARMFastISel.cpp (original)
+++ llvm/branches/release_29/lib/Target/ARM/ARMFastISel.cpp Tue Mar 22 14:45:56 2011
@@ -667,24 +667,29 @@
           TmpOffset += SL->getElementOffset(Idx);
         } else {
           uint64_t S = TD.getTypeAllocSize(GTI.getIndexedType());
-          SmallVector<const Value *, 4> Worklist;
-          Worklist.push_back(Op);
-          do {
-            Op = Worklist.pop_back_val();
+          for (;;) {
             if (const ConstantInt *CI = dyn_cast<ConstantInt>(Op)) {
               // Constant-offset addressing.
               TmpOffset += CI->getSExtValue() * S;
-            } else if (isa<AddOperator>(Op) &&
-                       isa<ConstantInt>(cast<AddOperator>(Op)->getOperand(1))) {
-              // An add with a constant operand. Fold the constant.
+              break;
+            }
+            if (isa<AddOperator>(Op) &&
+                (!isa<Instruction>(Op) ||
+                 FuncInfo.MBBMap[cast<Instruction>(Op)->getParent()]
+                 == FuncInfo.MBB) &&
+                isa<ConstantInt>(cast<AddOperator>(Op)->getOperand(1))) {
+              // An add (in the same block) with a constant operand. Fold the 
+              // constant.
               ConstantInt *CI =
-                cast<ConstantInt>(cast<AddOperator>(Op)->getOperand(1));
+              cast<ConstantInt>(cast<AddOperator>(Op)->getOperand(1));
               TmpOffset += CI->getSExtValue() * S;
-              // Add the other operand back to the work list.
-              Worklist.push_back(cast<AddOperator>(Op)->getOperand(0));
-            } else
-              goto unsupported_gep;
-          } while (!Worklist.empty());
+              // Iterate on the other operand.
+              Op = cast<AddOperator>(Op)->getOperand(0);
+              continue;
+            } 
+            // Unsupported
+            goto unsupported_gep;
+          }
         }
       }
 





More information about the llvm-branch-commits mailing list