summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-05-20 20:00:41 +0000
committerDan Gohman <gohman@apple.com>2010-05-20 20:00:41 +0000
commit8ec018cedfc2560ecb1beba159f3ad12cb8882b2 (patch)
treee84914c133fbca602b328ee19795e8d2929a5e29 /llvm/lib/Transforms
parent8ce95cc3c5e4a319d14509e0985b1faa447f1945 (diff)
downloadbcm5719-llvm-8ec018cedfc2560ecb1beba159f3ad12cb8882b2.tar.gz
bcm5719-llvm-8ec018cedfc2560ecb1beba159f3ad12cb8882b2.zip
Add some comments.
llvm-svn: 104268
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index 3c94616fe95..f99e3038765 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -2811,6 +2811,9 @@ void LSRInstance::NarrowSearchSpaceUsingHeuristics() {
bool Any = false;
for (size_t i = 0, e = LU.Formulae.size(); i != e; ++i) {
Formula &F = LU.Formulae[i];
+ // Look for a formula with a constant or GV in a register. If the use
+ // also has a formula with that same value in an immediate field,
+ // delete the one that uses a register.
for (SmallVectorImpl<const SCEV *>::const_iterator
I = F.BaseRegs.begin(), E = F.BaseRegs.end(); I != E; ++I) {
if (const SCEVConstant *C = dyn_cast<SCEVConstant>(*I)) {
@@ -2861,6 +2864,8 @@ void LSRInstance::NarrowSearchSpaceUsingHeuristics() {
"separated by a constant offset will use the same "
"registers.\n");
+ // This is especially useful for unrolled loops.
+
for (size_t LUIdx = 0, NumUses = Uses.size(); LUIdx != NumUses; ++LUIdx) {
LSRUse &LU = Uses[LUIdx];
for (size_t FIdx = 0, NumForms = LU.Formulae.size();
@@ -3074,6 +3079,7 @@ void LSRInstance::Solve(SmallVectorImpl<const Formula *> &Solution) const {
DenseSet<const SCEV *> VisitedRegs;
Workspace.reserve(Uses.size());
+ // SolveRecurse does all the work.
SolveRecurse(Solution, SolutionCost, Workspace, CurCost,
CurRegs, VisitedRegs);
OpenPOWER on IntegriCloud