[PATCH] D11250: Rename LoopInfo::Analyze() to LoopInfo::analyze() and turn its parameter type to const&.

Duncan P. N. Exon Smith dexonsmith at apple.com
Thu Jul 16 09:30:50 PDT 2015


> On 2015-Jul-15, at 16:51, Cong Hou <congh at google.com> wrote:
> 
> congh created this revision.
> congh added a reviewer: dexonsmith.
> congh added subscribers: llvm-commits, davidxl.
> 
> The benefit of turning the parameter of LoopInfo::analyze() to const& is that it now can accept a rvalue.
> 
> http://reviews.llvm.org/D11250
> 
> Files:
>  include/llvm/Analysis/LoopInfo.h
>  include/llvm/Analysis/LoopInfoImpl.h
>  include/llvm/CodeGen/MachineDominators.h
>  include/llvm/IR/Dominators.h
>  lib/Analysis/LoopInfo.cpp
>  lib/CodeGen/MachineLoopInfo.cpp
> 
> <D11250.29841.patch>

LGTM with a minor whitespace change.

> Index: include/llvm/Analysis/LoopInfoImpl.h
> ===================================================================
> --- include/llvm/Analysis/LoopInfoImpl.h
> +++ include/llvm/Analysis/LoopInfoImpl.h
> @@ -345,7 +345,7 @@
>  template<class BlockT, class LoopT>
>  static void discoverAndMapSubloop(LoopT *L, ArrayRef<BlockT*> Backedges,
>                                    LoopInfoBase<BlockT, LoopT> *LI,
> -                                  DominatorTreeBase<BlockT> &DomTree) {
> +                                  const DominatorTreeBase<BlockT> &DomTree) {
>    typedef GraphTraits<Inverse<BlockT*> > InvBlockTraits;
>  
>    unsigned NumBlocks = 0;
> @@ -468,10 +468,10 @@
>  /// insertions per block.
>  template<class BlockT, class LoopT>
>  void LoopInfoBase<BlockT, LoopT>::
> -Analyze(DominatorTreeBase<BlockT> &DomTree) {
> +analyze(const DominatorTreeBase<BlockT> &DomTree) {
>  
>    // Postorder traversal of the dominator tree.
> -  DomTreeNodeBase<BlockT>* DomRoot = DomTree.getRootNode();
> +  const DomTreeNodeBase<BlockT>* DomRoot = DomTree.getRootNode();

clang-format?  (`*` should be attached to the variable.)

>    for (auto DomNode : post_order(DomRoot)) {
>  
>      BlockT *Header = DomNode->getBlock();





More information about the llvm-commits mailing list