Changes in directory llvm/lib/Transforms/Scalar:
CodeGenPrepare.cpp updated: 1.2 -> 1.3 --- Log message: eliminate the last uses of some TLI methods. --- Diffs of the changes: (+7 -3) CodeGenPrepare.cpp | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) Index: llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp diff -u llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp:1.2 llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp:1.3 --- llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp:1.2 Sun Apr 1 20:35:34 2007 +++ llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp Mon Apr 9 18:29:07 2007 @@ -536,11 +536,15 @@ // Check if it is possible to fold the expression to address mode. if (UseTy && isa<ConstantInt>(BinOp->getOperand(1))) { - uint64_t Scale = TLI.getTargetData()->getTypeSize(UseTy); int64_t Cst = cast<ConstantInt>(BinOp->getOperand(1))->getSExtValue(); // e.g. load (gep i32 * %P, (X+42)) => load (%P + X*4 + 168). - if (TLI.isLegalAddressImmediate(Cst*Scale, UseTy) && - (Scale == 1 || TLI.isLegalAddressScale(Scale, UseTy))) { + TargetLowering::AddrMode AM; + // FIXME: This computation isn't right, scale is incorrect. + AM.Scale = TLI.getTargetData()->getTypeSize(UseTy); + // FIXME: Should should also include other fixed offsets. + AM.BaseOffs = Cst*AM.Scale; + + if (TLI.isLegalAddressingMode(AM, UseTy)) { DestBBs.insert(GEPIBB); MadeChange = true; break; _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits