[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
Chris Lattner
lattner at cs.uiuc.edu
Mon Aug 1 18:32:40 PDT 2005
Changes in directory llvm/lib/Transforms/Scalar:
LoopStrengthReduce.cpp updated: 1.18 -> 1.19
---
Log message:
Add a comment
Make LSR ignore GEP's that have loop variant base values, as we currently
cannot codegen them
---
Diffs of the changes: (+10 -0)
LoopStrengthReduce.cpp | 10 ++++++++++
1 files changed, 10 insertions(+)
Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.18 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.19
--- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.18 Mon Aug 1 19:41:11 2005
+++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp Mon Aug 1 20:32:29 2005
@@ -251,6 +251,9 @@
UIntPtrTy));
} else {
SCEVHandle Idx = SE->getSCEV(GEP->getOperand(i));
+
+ // If this operand is reducible, and it's not the one we are looking at
+ // currently, do not process the GEP at this time.
if (CanReduceSCEV(Idx, L))
return;
Base = SCEVAddExpr::get(Base, GetAdjustedIndex(Idx,
@@ -287,6 +290,13 @@
assert(CanReduceSCEV(GEPIndexExpr, L) && "Non reducible idx??");
+ // FIXME: If the base is not loop invariant, we currently cannot emit this.
+ if (!Base->isLoopInvariant(L)) {
+ DEBUG(std::cerr << "IGNORING GEP due to non-invaiant base: "
+ << *Base << "\n");
+ return;
+ }
+
Base = SCEVAddExpr::get(Base, cast<SCEVAddRecExpr>(GEPIndexExpr)->getStart());
SCEVHandle Stride = cast<SCEVAddRecExpr>(GEPIndexExpr)->getOperand(1);
More information about the llvm-commits
mailing list