[all-commits] [llvm/llvm-project] 6047de: [llvm] Provide utility function for MD_prof

Paul Kirth via All-commits all-commits at lists.llvm.org
Wed Jul 27 14:14:11 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6047deb7c2aa94d9bc2b70b49799d22cce778bd4
      https://github.com/llvm/llvm-project/commit/6047deb7c2aa94d9bc2b70b49799d22cce778bd4
  Author: Paul Kirth <paulkirth at google.com>
  Date:   2022-07-27 (Wed, 27 Jul 2022)

  Changed paths:
    A llvm/include/llvm/IR/ProfDataUtils.h
    M llvm/lib/IR/CMakeLists.txt
    A llvm/lib/IR/ProfDataUtils.cpp
    M llvm/unittests/Transforms/Utils/CMakeLists.txt
    A llvm/unittests/Transforms/Utils/ProfDataUtilTest.cpp

  Log Message:
  -----------
  [llvm] Provide utility function for MD_prof

Currently, there is significant code duplication for dealing with
MD_prof metadata throughout the compiler. These utility functions can
improve code reuse and simplify boilerplate code when dealing with
profiling metadata, such as branch weights. The inent is to provide a
uniform set of APIs that allow common tasks, such as identifying
specific types of MD_prof metadata and extracting branch weights.

Future patches can build on this initial implementation and clean up the
different implementations across the compiler.

Reviewed By: bogner

Differential Revision: https://reviews.llvm.org/D128858


  Commit: 300c9a78819b4608b96bb26f9320bea6b8a0c4d0
      https://github.com/llvm/llvm-project/commit/300c9a78819b4608b96bb26f9320bea6b8a0c4d0
  Author: Paul Kirth <paulkirth at google.com>
  Date:   2022-07-27 (Wed, 27 Jul 2022)

  Changed paths:
    M llvm/include/llvm/IR/Instruction.h
    M llvm/lib/Analysis/BranchProbabilityInfo.cpp
    M llvm/lib/CodeGen/CodeGenPrepare.cpp
    M llvm/lib/CodeGen/SelectOptimize.cpp
    M llvm/lib/IR/Metadata.cpp
    M llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
    M llvm/lib/Transforms/IPO/PartialInlining.cpp
    M llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
    M llvm/lib/Transforms/Scalar/JumpThreading.cpp
    M llvm/lib/Transforms/Utils/LoopPeel.cpp
    M llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
    M llvm/lib/Transforms/Utils/LoopUtils.cpp
    M llvm/lib/Transforms/Utils/MisExpect.cpp
    M llvm/lib/Transforms/Utils/SimplifyCFG.cpp

  Log Message:
  -----------
  [llvm][NFC] Refactor code to use ProfDataUtils

In this patch we replace common code patterns with the use of utility
functions for dealing with profiling metadata. There should be no change
in functionality, as the existing checks should be preserved in all
cases.

Reviewed By: bogner, davidxl

Differential Revision: https://reviews.llvm.org/D128860


Compare: https://github.com/llvm/llvm-project/compare/719ab04acf97...300c9a78819b


More information about the All-commits mailing list