[llvm-commits] [llvm] r127591 - /llvm/trunk/lib/Analysis/ScalarEvolution.cpp

Andrew Trick atrick at apple.com
Mon Mar 14 17:56:25 PDT 2011


On Mar 14, 2011, at 4:32 PM, Eli Friedman wrote:
> Hmm... getBackedgeTakenCount and getMaxBackedgeTakenCount have
> surprisingly few users.  One user of getBackedgeTakenCount is IndVars,
> which will try to rewrite the exit condition in terms of the backedge
> taken count.  It assumes that the count is both the exit count and the
> maximum loop count of the loop.  On the other hand, LoopIdiomRecognize
> doesn't really care what the max iteration count is (I'm not
> completely sure it's safe for other reasons, but that isn't really
> related).  I'm not sure I really follow what LSR is doing with the
> backedge taken count.  LoopDeletion uses the MaxBackedgeTakenCount to
> make sure a loop isn't infinite.  And I think that actually
> exhaustively covers all the uses of the backedge counts.  So
> basically, if we can't actually do an indvars transform, very little
> actually looks at the backedge count directly.  Some places that use
> LoopInfo::getTripCount() and friends could probably be changed to be
> more aggressive, though.
> 
> -Eli

Thanks for the analysis. FYI: I'm working toward suppressing some of the indvars transforms. Particularly the canonicalization of induction vars. Doing this will make LSR an optional pass--we can turn it off without pessimizing the code. LSR needs work, but I'm not there yet.

-Andy



More information about the llvm-commits mailing list