[PATCH] D139870: [BOLT] using jump weights in profi

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 11 13:54:27 PST 2023


hoy added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/SampleProfileInference.cpp:1120
-    // as all of the increase can be attributed to the self-edge
-    if (Block.HasSelfEdge) {
-      AuxCostDec = 0;
----------------
spupyrev wrote:
> hoy wrote:
> > Where is this handled in the new implementation?
> This is a good question; we don't have this condition anymore. While in theory there might be a difference, I do not see a single instance (in my benchmark with 10K functions) where this statement yields a different result. So it must be quite rare.
> More importantly, I do not remember the original motivation: Why is it "correct" not to penalize blocks with self loops?
Oh, it might be related to a Skylake-specific hardware issue where a LBR entry can occur consecutively redundantly. Decreasing the backedge count may make sense. Otherwise I cannot think of why self-loop is special from normal loops. 

The Skylake issue is worked around in the profile generation time so we should be free from that now.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139870/new/

https://reviews.llvm.org/D139870



More information about the llvm-commits mailing list