[PATCH] D24790: [LoopUnroll] Use the upper bound of the loop trip count to completely unroll loops
Haicheng Wu via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 14 21:49:24 PST 2016
haicheng added inline comments.
================
Comment at: llvm/trunk/lib/Transforms/Scalar/LoopUnrollPass.cpp:1027
// Unroll the loop.
if (!UnrollLoop(L, UP.Count, TripCount, UP.Force, UP.Runtime,
+ UP.AllowExpensiveTripCount, UseUpperBound, TripMultiple, LI,
----------------
evstupac wrote:
> Sorry for comment after approve.
> What I see here is that TripCount could implicitly (as TripCount was passed to computeUnrollCount as a reference) become MaxTripCount. Here it is passed to UnrollLoop as TripCount.
> Could you please add a comment to UnrollLoop that TripCount parameter is not always a real loop trip count, but sometimes MaxTripCount. Or rename TripCount to MaxTripCount in UnrollLoop parameters. There could be future errors if someone assumes that TripCount is exact loop trip count.
I will modify the comments in a separate patch to make it clearer. However, you may need to know that even the trip counter is calculated by SCEV::getSmallConstantTripCount(), it may not be the exact times the loop header get executed. Please see the comments before llvm::UnrollLoop() in LoopUnroll.cpp.
Repository:
rL LLVM
https://reviews.llvm.org/D24790
More information about the llvm-commits
mailing list