diff options
author | Bill Wendling <isanbard@gmail.com> | 2011-03-22 19:45:56 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2011-03-22 19:45:56 +0000 |
commit | bc552ec99e7c6ed0acf1825ee543c87387709b5b (patch) | |
tree | 9133be00f5ed6af29726afa103d157f22093497d | |
parent | 9a68f59e14795fc50ff69c8e422115a500ef998e (diff) | |
download | llvm-bc552ec99e7c6ed0acf1825ee543c87387709b5b.zip llvm-bc552ec99e7c6ed0acf1825ee543c87387709b5b.tar.gz llvm-bc552ec99e7c6ed0acf1825ee543c87387709b5b.tar.bz2 |
--- Merging r128100 into '.':
U lib/Target/ARM/ARMFastISel.cpp
llvm-svn: 128101
-rw-r--r-- | llvm/lib/Target/ARM/ARMFastISel.cpp | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/llvm/lib/Target/ARM/ARMFastISel.cpp b/llvm/lib/Target/ARM/ARMFastISel.cpp index 26f48b3..c7385b7 100644 --- a/llvm/lib/Target/ARM/ARMFastISel.cpp +++ b/llvm/lib/Target/ARM/ARMFastISel.cpp @@ -667,24 +667,29 @@ bool ARMFastISel::ARMComputeAddress(const Value *Obj, Address &Addr) { 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; + } } } |