[PATCH] D10979: Update the branch weight metadata in JumpThreading pass.

Duncan P. N. Exon Smith dexonsmith at apple.com
Tue Jul 7 10:39:01 PDT 2015


> On 2015-Jul-06, at 17:22, Cong Hou <congh at google.com> wrote:
> 
> 
> congh added reviewers: chandlerc, davidxl.
> congh added a subscriber: llvm-commits.
> 
> Currently in JumpThreading pass, the branch weight metadata is not updated after CFG modification. Consider the jump threading on PredBB, BB, and SuccBB. After jump threading, the weight on BB->SuccBB should be adjusted as some of it is contributed by the edge PredBB->BB, which doesn't exist anymore. This patch tries to update the edge weight in metadata on BB->SuccBB by scaling it by 1 - Freq(PredBB->BB) / Freq(BB->SuccBB). Two more analyses (BlockFrequencyInfo and BranchProbabilityInfo) are needed then.

Thanks for working on this!

Generally you don't need these analyses to keep branch weights
up-to-date.  The design premise is that you don't need global
information for local updates.

You should be able to calculate the new !prof attachment based on the
old ones, without running BFI.  (I'm skeptical of even running BPI -- if
there's no !prof attachment on the old block, then you have no real
information; what's the benefit in generating a new !prof attachment
based on heuristics?  The new CFG will come with its own new
heuristics.)

Please reformulate this calculation in terms of local branch weights
instead of block frequency.

> http://reviews.llvm.org/D10979
> 
> Files:
>  lib/Transforms/Scalar/JumpThreading.cpp
> 
> <D10979.29140.patch>_______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits





More information about the llvm-commits mailing list