diff options
| author | Chris Lattner <sabre@nondot.org> | 2005-08-02 01:32:29 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2005-08-02 01:32:29 +0000 |
| commit | 9ef129421027221908ce159774f62755d1c4061f (patch) | |
| tree | 837bd0501961328a3cde8fe29ebba89540dc2933 /llvm/lib/Transforms | |
| parent | 564900e5e5039bcde465aa6d2daa7efe3f3d344b (diff) | |
| download | bcm5719-llvm-9ef129421027221908ce159774f62755d1c4061f.tar.gz bcm5719-llvm-9ef129421027221908ce159774f62755d1c4061f.zip | |
Add a comment
Make LSR ignore GEP's that have loop variant base values, as we currently
cannot codegen them
llvm-svn: 22576
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 0967fb7200b..f3834158c1c 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -251,6 +251,9 @@ void LoopStrengthReduce::AnalyzeGetElementPtrUsers(GetElementPtrInst *GEP, 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 @@ void LoopStrengthReduce::AnalyzeGetElementPtrUsers(GetElementPtrInst *GEP, 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); |

