History log of /llvm-project/llvm/lib/IR/ProfDataUtils.cpp (Results 1 – 19 of 19)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4
# 6f10b652 02-Nov-2024 Kazu Hirata <kazu@google.com>

[IR] Remove unused includes (NFC) (#114679)

Identified with misc-include-cleaner.


Revision tags: llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1
# c71b2122 25-Sep-2024 Matt Arsenault <Matthew.Arsenault@amd.com>

ProfDataUtils: Avoid dyn_extract + assert (NFC)


Revision tags: llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init
# a3a44bfb 24-Jun-2024 Paul Kirth <paulkirth@google.com>

[llvm][ProfDataUtils] Provide getNumBranchWeights API (#90146)

As suggested in
https://github.com/llvm/llvm-project/pull/86609/files#r1556689262
an API for getting the number of branch weights dir

[llvm][ProfDataUtils] Provide getNumBranchWeights API (#90146)

As suggested in
https://github.com/llvm/llvm-project/pull/86609/files#r1556689262
an API for getting the number of branch weights directly from the MD
node would be useful in a variety of checks, and keeps the logic within
ProfDataUtils.

show more ...


Revision tags: llvmorg-18.1.8
# 294f3ce5 12-Jun-2024 Paul Kirth <paulkirth@google.com>

Reapply "[llvm][IR] Extend BranchWeightMetadata to track provenance o… (#95281)

…f weights" #95136

Reverts #95060, and relands #86609, with the unintended code generation
changes addressed.

T

Reapply "[llvm][IR] Extend BranchWeightMetadata to track provenance o… (#95281)

…f weights" #95136

Reverts #95060, and relands #86609, with the unintended code generation
changes addressed.

This patch implements the changes to LLVM IR discussed in
https://discourse.llvm.org/t/rfc-update-branch-weights-metadata-to-allow-tracking-branch-weight-origins/75032

In this patch, we add an optional field to MD_prof meatdata nodes for
branch weights, which can be used to distinguish weights added from
llvm.expect* intrinsics from those added via other methods, e.g. from
profiles or inserted by the compiler.

One of the major motivations, is for use with MisExpect diagnostics,
which need to know if branch_weight metadata originates from an
llvm.expect intrinsic. Without that information, we end up checking
branch weights multiple times in the case if ThinLTO + SampleProfiling,
leading to some inaccuracy in how we report MisExpect related
diagnostics to users.

Since we change the format of MD_prof metadata in a fundamental way, we
need to update code handling branch weights in a number of places.

We also update the lang ref for branch weights to reflect the change.

show more ...


# 607afa0b 11-Jun-2024 Paul Kirth <paulkirth@google.com>

Revert "[llvm][IR] Extend BranchWeightMetadata to track provenance of weights" (#95060)

Reverts llvm/llvm-project#86609

This change causes compile-time regressions for stage2 builds
(https://llv

Revert "[llvm][IR] Extend BranchWeightMetadata to track provenance of weights" (#95060)

Reverts llvm/llvm-project#86609

This change causes compile-time regressions for stage2 builds
(https://llvm-compile-time-tracker.com/compare.php?from=3254f31a66263ea9647c9547f1531c3123444fcd&to=c5978f1eb5eeca8610b9dfce1fcbf1f473911cd8&stat=instructions:u).
It also introduced unintended changes to `.text` which should be
addressed before relanding.

show more ...


# c5978f1e 10-Jun-2024 Paul Kirth <paulkirth@google.com>

[llvm][IR] Extend BranchWeightMetadata to track provenance of weights (#86609)

This patch implements the changes to LLVM IR discussed in

https://discourse.llvm.org/t/rfc-update-branch-weights-met

[llvm][IR] Extend BranchWeightMetadata to track provenance of weights (#86609)

This patch implements the changes to LLVM IR discussed in

https://discourse.llvm.org/t/rfc-update-branch-weights-metadata-to-allow-tracking-branch-weight-origins/75032

In this patch, we add an optional field to MD_prof metadata nodes for
branch weights, which can be used to distinguish weights added from
`llvm.expect*` intrinsics from those added via other methods, e.g.
from profiles or inserted by the compiler.

One of the major motivations, is for use with MisExpect diagnostics,
which need to know if branch_weight metadata originates from an
llvm.expect intrinsic. Without that information, we end up checking
branch weights multiple times in the case if ThinLTO + SampleProfiling,
leading to some inaccuracy in how we report MisExpect related
diagnostics to users.

Since we change the format of MD_prof metadata in a fundamental way, we
need to update code handling branch weights in a number of places.

We also update the lang ref for branch weights to reflect the change.

show more ...


Revision tags: llvmorg-18.1.7, llvmorg-18.1.6
# 64f4ceb0 08-May-2024 Mingming Liu <mingmingl@google.com>

[Inline][PGO] After inline, update InvokeInst profile counts in caller and cloned callee (#83809)

A related change is https://reviews.llvm.org/D133121, which correctly
preserves both branch weights

[Inline][PGO] After inline, update InvokeInst profile counts in caller and cloned callee (#83809)

A related change is https://reviews.llvm.org/D133121, which correctly
preserves both branch weights and value profiles for invoke instruction.
* If the branch weight of the `invokeinst` specifies taken / not-taken branches, there is no scale.

show more ...


Revision tags: llvmorg-18.1.5
# 7538df90 30-Apr-2024 Paul Kirth <paulkirth@google.com>

[llvm][profdata][NFC] Support 64-bit weights in ProfDataUtils (#86607)

Since some places, like SimplifyCFG, work with 64-bit weights, we supply
an API in ProfDataUtils to extract the weights accord

[llvm][profdata][NFC] Support 64-bit weights in ProfDataUtils (#86607)

Since some places, like SimplifyCFG, work with 64-bit weights, we supply
an API in ProfDataUtils to extract the weights accordingly.

We change the API slightly to disambiguate the 64-bit version from the
32-bit version.

show more ...


# 4e6f6fda 30-Apr-2024 Kazu Hirata <kazu@google.com>

[IR] Use StringRef::operator== instead of StringRef::equals (NFC) (#90550)

I'm planning to remove StringRef::equals in favor of
StringRef::operator==.

- StringRef::operator== outnumbers StringRe

[IR] Use StringRef::operator== instead of StringRef::equals (NFC) (#90550)

I'm planning to remove StringRef::equals in favor of
StringRef::operator==.

- StringRef::operator== outnumbers StringRef::equals by a factor of 22
under llvm/ in terms of their usage.

- The elimination of StringRef::equals brings StringRef closer to
std::string_view, which has operator== but not equals.

- S == "foo" is more readable than S.equals("foo"), especially for
!Long.Expression.equals("str") vs Long.Expression != "str".

show more ...


Revision tags: llvmorg-18.1.4, llvmorg-18.1.3
# 2d641858 27-Mar-2024 Mingming Liu <mingmingl@google.com>

[nfc][PGO]Factor out profile scaling into a standalone helper function (#83780)

- Put the helper function in `ProfDataUtil.h/cpp`, which is already a
dependency of `Instructions.cpp`
- The helper

[nfc][PGO]Factor out profile scaling into a standalone helper function (#83780)

- Put the helper function in `ProfDataUtil.h/cpp`, which is already a
dependency of `Instructions.cpp`
- The helper function could be re-used to update profiles of
`InvokeInst` (in a follow-up pull request)

show more ...


Revision tags: llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2
# 6ce03ff3 05-Feb-2024 Shubham Sandeep Rastogi <srastogi22@apple.com>

Revert "[IR] Use range-based for loops (NFC)"

This reverts commit e8512786fedbfa6ddba70ceddc29d7122173ba5e.

This revert is done because llvm::drop_begin over an empty ArrayRef
doesn't return an emp

Revert "[IR] Use range-based for loops (NFC)"

This reverts commit e8512786fedbfa6ddba70ceddc29d7122173ba5e.

This revert is done because llvm::drop_begin over an empty ArrayRef
doesn't return an empty range, and therefore can lead to an invalid
address returned instead.

See discussion in https://github.com/llvm/llvm-project/pull/80737 for
more context.

show more ...


# e8512786 01-Feb-2024 Kazu Hirata <kazu@google.com>

[IR] Use range-based for loops (NFC)


Revision tags: llvmorg-18.1.0-rc1
# 8f8cab6b 28-Jan-2024 Kazu Hirata <kazu@google.com>

[llvm] Use Instruction::hasMetadata (NFC)


Revision tags: llvmorg-19-init, llvmorg-17.0.6
# cb4627d1 16-Nov-2023 Matthias Braun <matze@braunis.de>

Add setBranchWeigths convenience function. NFC (#72446)

Add `setBranchWeights` convenience function to ProfDataUtils.h and use
it where appropriate.


Revision tags: llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3
# 285e0235 14-Aug-2023 Matthias Braun <matze@braunis.de>

ProfDataUtils: Add extractFromBranchWeightMD function; NFC

Expose internal helper function as new `extractFromBranchWeightMD` API.

Differential revision: https://reviews.llvm.org/D157937


Revision tags: llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init
# e741b8c2 19-Jan-2023 Christian Ulmann <christian.ulmann@nextsilicon.com>

[llvm][ir] Purge MD_prof custom accessors

This commit purges direct accesses to MD_prof metadata and replaces them
with the accessors provided from the utility file wherever possible.
This commit ca

[llvm][ir] Purge MD_prof custom accessors

This commit purges direct accesses to MD_prof metadata and replaces them
with the accessors provided from the utility file wherever possible.
This commit can be seen as the first step towards switching the branch weights to 64 bits.
See post here: https://discourse.llvm.org/t/extend-md-prof-branch-weights-metadata-from-32-to-64-bits/67492

Reviewed By: davidxl, paulkirth

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

show more ...


Revision tags: llvmorg-15.0.7, llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, working, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0
# deef5b8c 26-Aug-2022 Paul Kirth <paulkirth@google.com>

[llvm][ir][NFC] Clean up "if after return" in ProfDataUtils.cpp

Reviewed By: tejohnson

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


Revision tags: llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2
# a812b39e 05-Aug-2022 Paul Kirth <paulkirth@google.com>

[llvm][ir] Add missing license to ProfDataUtils

We failed to add these in D128860 or D128858

Reviewed By: davidxl

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


Revision tags: llvmorg-15.0.0-rc1, llvmorg-16-init
# 6047deb7 19-Jul-2022 Paul Kirth <paulkirth@google.com>

[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

[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

show more ...