[llvm-commits] [llvm] r137190 - in /llvm/trunk: include/llvm/Analysis/LoopInfo.h lib/Transforms/Utils/LoopUnroll.cpp test/Transforms/LoopUnroll/2011-08-08-PhiUpdate.ll test/Transforms/LoopUnroll/2011-08-09-PhiUpdate.ll
Andrew Trick
atrick at apple.com
Tue Aug 9 17:53:46 PDT 2011
On Aug 9, 2011, at 5:36 PM, Eli Friedman wrote:
>> + /// getNumBlocks - Get the number of blocks in this loop.
>> + unsigned getNumBlocks() const {
>> + return std::distance(block_begin(), block_end());
>> + }
>
> I do not think this is a good idea; any user that cares can write the
> expression with std::distance, and having an accessor gives the
> illusion that it's constant time.
I wanted a way to stress that Loop needs to provide a constant-time accessor for number of blocks. It's an assumption made by LoopIterator and a few other places (some I have not checked in yet).
Using std::distance was unnecessary, I cleaned it up. I also didn't notice the getBlocks() accessor. Feel free to replace uses of getNumBlocks with it, although I was trying not to expose the Blocks type to the client code.
-Andy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110809/54221bc7/attachment.html>
More information about the llvm-commits
mailing list