[all-commits] [llvm/llvm-project] bb6497: [BPI] Reuse the AsmWriter's BB naming scheme in Br...

Mircea Trofin via All-commits all-commits at lists.llvm.org
Sat Dec 2 13:02:01 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bb6497ffa6a88d1b3a32101d9b6519094d75ef2a
      https://github.com/llvm/llvm-project/commit/bb6497ffa6a88d1b3a32101d9b6519094d75ef2a
  Author: Mircea Trofin <mtrofin at google.com>
  Date:   2023-12-02 (Sat, 02 Dec 2023)

  Changed paths:
    M llvm/lib/Analysis/BranchProbabilityInfo.cpp
    A llvm/test/Analysis/BranchProbabilityInfo/anonymous-bb.ll
    M llvm/test/Analysis/BranchProbabilityInfo/basic.ll
    M llvm/test/Analysis/BranchProbabilityInfo/deopt-intrinsic.ll
    M llvm/test/Analysis/BranchProbabilityInfo/deopt-invoke.ll
    M llvm/test/Analysis/BranchProbabilityInfo/fcmp.ll
    M llvm/test/Analysis/BranchProbabilityInfo/hoist.ll
    M llvm/test/Analysis/BranchProbabilityInfo/libfunc_call.ll
    M llvm/test/Analysis/BranchProbabilityInfo/loop.ll
    M llvm/test/Analysis/BranchProbabilityInfo/noreturn.ll
    M llvm/test/Analysis/BranchProbabilityInfo/pointer_heuristics.ll
    M llvm/test/Analysis/BranchProbabilityInfo/pr18705.ll
    M llvm/test/Analysis/BranchProbabilityInfo/pr22718.ll
    M llvm/test/Analysis/BranchProbabilityInfo/switch.ll
    M llvm/test/Analysis/BranchProbabilityInfo/unreachable.ll
    M llvm/test/Analysis/BranchProbabilityInfo/zero_heuristics.ll
    M llvm/test/Transforms/PGOProfile/indirectbr.ll
    M llvm/test/Transforms/SampleProfile/branch.ll
    M llvm/test/Transforms/SampleProfile/calls.ll
    M llvm/test/Transforms/SampleProfile/discriminator.ll
    M llvm/test/Transforms/SampleProfile/fnptr.ll
    M llvm/test/Transforms/SampleProfile/fsafdo_test.ll
    M llvm/test/Transforms/SampleProfile/offset.ll
    M llvm/test/Transforms/SampleProfile/profile-inference-even-count-distribution.ll
    M llvm/test/Transforms/SampleProfile/profile-inference-rebalance-large.ll
    M llvm/test/Transforms/SampleProfile/profile-inference-rebalance.ll
    M llvm/test/Transforms/SampleProfile/profile-inference.ll
    M llvm/test/Transforms/SampleProfile/propagate.ll
    M llvm/test/Transforms/SampleProfile/remap.ll
    M llvm/test/tools/UpdateTestChecks/update_analyze_test_checks/Inputs/branch-probability-analysis.ll.expected

  Log Message:
  -----------
  [BPI] Reuse the AsmWriter's BB naming scheme in BranchProbabilityPrinterPass (#73593)

When using `BranchProbabilityPrinterPass`, if a BB has no name, we get pretty unusable information like `edge -> has probability...` (i.e. we have no idea what the vertices of that edge are).

This patch uses `printAsOperand`, which uses the same naming scheme as `Function::dump`, so for example during debugging sessions, the IR obtained from a function and the names used by `BranchProbabilityPrinterPass` will match.

A shortcoming is that `printAsOperand` will result in the numbering algorithm re-running for every edge and every vertex (when `BranchProbabilityPrinterPass` is run on a function). If, for the given scenario, this is a problem, we can revisit this subsequently.

Another nuance is that the entry basic block will be numbered, which may be slightly confusing when it's anonymous, but it's easily identifiable - the first edge would have it as source (and the number should be easily recognizable)




More information about the All-commits mailing list