[PATCH] D11104: Add setBlockFreq interface to BlockFrequencyInfo, BlockFrequencyInfoImplBase, and BlockFrequencyInfoImpl.

Duncan P. N. Exon Smith dexonsmith at apple.com
Fri Jul 10 12:06:29 PDT 2015


> On 2015-Jul-10, at 11:26, Cong Hou <congh at google.com> wrote:
> 
> congh created this revision.
> congh added reviewers: dexonsmith, davidxl.
> congh added subscribers: llvm-commits, davidxl.
> 
> This patch make it possible to directly change the block frequency through BFI instead of updating block frequencies for the whole function (which is relatively expensive). This is useful when there are small local frequency changes and the up-to-date BFI is needed soon.
> 
> http://reviews.llvm.org/D11104
> 
> Files:
>  include/llvm/Analysis/BlockFrequencyInfo.h
>  include/llvm/Analysis/BlockFrequencyInfoImpl.h
>  lib/Analysis/BlockFrequencyInfo.cpp
>  lib/Analysis/BlockFrequencyInfoImpl.cpp
> 
> 



> Index: include/llvm/Analysis/BlockFrequencyInfoImpl.h
> ===================================================================
> --- include/llvm/Analysis/BlockFrequencyInfoImpl.h
> +++ include/llvm/Analysis/BlockFrequencyInfoImpl.h
> @@ -456,6 +456,8 @@
> 
>   BlockFrequency getBlockFreq(const BlockNode &Node) const;
> 
> +  bool setBlockFreq(const BlockNode &Node, uint64_t Freq);
> +
>   raw_ostream &printBlockFreq(raw_ostream &OS, const BlockNode &Node) const;
>   raw_ostream &printBlockFreq(raw_ostream &OS,
>                               const BlockFrequency &Freq) const;
> @@ -886,6 +888,9 @@
>   BlockFrequency getBlockFreq(const BlockT *BB) const {
>     return BlockFrequencyInfoImplBase::getBlockFreq(getNode(BB));
>   }
> +  bool setBlockFreq(const BlockT *BB, uint64_t Freq) {
> +    return BlockFrequencyInfoImplBase::setBlockFreq(getNode(BB), Freq);

You'll be setting block frequencies for new basic blocks as well, right?
What does `getNode()` return for unknown basic blocks?

> +  }
>   Scaled64 getFloatingBlockFreq(const BlockT *BB) const {
>     return BlockFrequencyInfoImplBase::getFloatingBlockFreq(getNode(BB));
>   }




More information about the llvm-commits mailing list