[llvm-commits] [llvm] r41207 - in /llvm/trunk: include/llvm/Analysis/LoopInfo.h lib/Analysis/LoopInfo.cpp lib/Analysis/ScalarEvolution.cpp lib/Transforms/IPO/LoopExtractor.cpp lib/Transforms/Scalar/IndVarSimplify.cpp lib/Transforms/Scalar/LICM.cpp lib/Transforms/Scalar/LoopRotation.cpp lib/Transforms/Scalar/LoopUnswitch.cpp lib/Transforms/Utils/LCSSA.cpp lib/Transforms/Utils/LoopSimplify.cpp
Chris Lattner
clattner at apple.com
Mon Aug 20 20:43:42 PDT 2007
> URL: http://llvm.org/viewvc/llvm-project?rev=41207&view=rev
> Log:
> Use SmallVector instead of std::vector.
Thanks Devang,
Two minor tweaks:
> /// outside of the loop. These are the blocks _inside of the
> current loop_
> /// which branch out. The returned list is always unique.
> ///
> - void getExitingBlocks(std::vector<BasicBlock*> &Blocks) const;
> + void getExitingBlocks(SmallVector<BasicBlock *, 8> &Blocks) const;
One of the nifty but non-obvious features of smallvector is that
libraries who operate on a smallvector don't have to know the size
that the client declared it as. Instead of hardcoding 8 in here,
just declare these as taking "SmallVectorImpl<BasicBlock*>&". This
will let clients decide "how small small should be". :)
> +void Loop::getExitingBlocks(SmallVector<BasicBlock*, 8>
> &ExitingBlocks) const {
> std::vector<BasicBlock*> LoopBBs(block_begin(), block_end());
> +void Loop::getExitBlocks(SmallVector<BasicBlock*, 8> &ExitBlocks)
> const {
> std::vector<BasicBlock*> LoopBBs(block_begin(), block_end());
> +void Loop::getUniqueExitBlocks(SmallVector<BasicBlock*, 8>
> &ExitBlocks) const {
> std::vector<BasicBlock*> LoopBBs(block_begin(), block_end());
Since you're in here, these are good candidates for (large)
smallvectors also. Try making them SmallVector<, 128> for example.
-Chris
More information about the llvm-commits
mailing list