From: Dan Gohman Date: Thu, 20 May 2010 20:00:41 +0000 (+0000) Subject: Add some comments. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=f7ff37d6745bfe170458e1165a5109cd2432d99d;p=oota-llvm.git Add some comments. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104268 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 3c94616fe95..f99e3038765 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/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_iterator I = F.BaseRegs.begin(), E = F.BaseRegs.end(); I != E; ++I) { if (const SCEVConstant *C = dyn_cast(*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 &Solution) const { DenseSet VisitedRegs; Workspace.reserve(Uses.size()); + // SolveRecurse does all the work. SolveRecurse(Solution, SolutionCost, Workspace, CurCost, CurRegs, VisitedRegs);