<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp, branch users/nico/python-2</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>[ICP] Use a block with LLVM_DEBUG (NFC) (#140387)</title>
<updated>2025-05-17T19:59:21+00:00</updated>
<author>
<name>Kazu Hirata</name>
<email>kazu@google.com</email>
</author>
<published>2025-05-17T19:59:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=0642bf9a9830fdab88f9bf15243e965a03c78b3f'/>
<id>0642bf9a9830fdab88f9bf15243e965a03c78b3f</id>
<content type='text'>
Using a block inside LLVM_DEBUG allows us to simplify the code with a
single LLVM_DEBUG and remove maybe_unused.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Using a block inside LLVM_DEBUG allows us to simplify the code with a
single LLVM_DEBUG and remove maybe_unused.</pre>
</div>
</content>
</entry>
<entry>
<title>[Transforms] Use *Set::insert_range (NFC) (#132652)</title>
<updated>2025-03-24T02:42:53+00:00</updated>
<author>
<name>Kazu Hirata</name>
<email>kazu@google.com</email>
</author>
<published>2025-03-24T02:42:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=73dc2afd2c334aac735caba94292052d63014c9d'/>
<id>73dc2afd2c334aac735caba94292052d63014c9d</id>
<content type='text'>
We can use *Set::insert_range to collapse:

  for (auto Elem : Range)
    Set.insert(E);

down to:

  Set.insert_range(Range);

In some cases, we can further fold that into the set declaration.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We can use *Set::insert_range to collapse:

  for (auto Elem : Range)
    Set.insert(E);

down to:

  Set.insert_range(Range);

In some cases, we can further fold that into the set declaration.</pre>
</div>
</content>
</entry>
<entry>
<title>[Instrumentation] Remove unused includes (NFC) (#115117)</title>
<updated>2024-11-06T16:36:34+00:00</updated>
<author>
<name>Kazu Hirata</name>
<email>kazu@google.com</email>
</author>
<published>2024-11-06T16:36:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=4d12a14357b136e996f8789786f1b76348b5582b'/>
<id>4d12a14357b136e996f8789786f1b76348b5582b</id>
<content type='text'>
Identified with misc-include-cleaner.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Identified with misc-include-cleaner.</pre>
</div>
</content>
</entry>
<entry>
<title>[LLVM] Add `Intrinsic::getDeclarationIfExists` (#112428)</title>
<updated>2024-10-16T14:21:10+00:00</updated>
<author>
<name>Rahul Joshi</name>
<email>rjoshi@nvidia.com</email>
</author>
<published>2024-10-16T14:21:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=6924fc03260370876f7091ba06cdc350989ac3c5'/>
<id>6924fc03260370876f7091ba06cdc350989ac3c5</id>
<content type='text'>
Add `Intrinsic::getDeclarationIfExists` to lookup an existing
declaration of an intrinsic in a `Module`.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add `Intrinsic::getDeclarationIfExists` to lookup an existing
declaration of an intrinsic in a `Module`.</pre>
</div>
</content>
</entry>
<entry>
<title>[TypeProf][PGO]Support skipping vtable comparisons for a class and its derived ones (#110575)</title>
<updated>2024-10-02T17:23:54+00:00</updated>
<author>
<name>Mingming Liu</name>
<email>mingmingl@google.com</email>
</author>
<published>2024-10-02T17:23:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=34f0edd50992e6d18c80dd901caf1e8220be673b'/>
<id>34f0edd50992e6d18c80dd901caf1e8220be673b</id>
<content type='text'>
Performance critical core libraries could be highly-optimized for arch
or micro-arch features. For instance, the absl crc library specializes
different templated classes among different hardwares [1]. In a
practical setting, it's likely that instrumented profiles are collected
on one type of machine and used to optimize binaries that run on
multiple types of hardwares.

While this kind of specialization is rare in terms of lines of code,
compiler can do a better job to skip vtable-based ICP.
* The per-class `Extend` implementation is arch-specific as well. If an
instrumented profile is collected on one arch and applied to another
arch where `Extend` implementation is different, `Extend` might be
regarded as unlikely function in the latter case. `ABSL_ATTRIBUTE_HOT`
annotation alleviates the problem by putting all `Extend` implementation
into the hot text section [2]

This change introduces a comma-separated list to specify the mangled
vtable names, and ICP pass will skip vtable-based comparison if a vtable
variable definition is shown to be in its class hierarchy (per LLVM type
metadata).

[1]
https://github.com/abseil/abseil-cpp/blob/c6b27359c3d27438b1313dddd7598914c1274a50/absl/crc/internal/crc_x86_arm_combined.cc#L621-L650
[2]
https://github.com/abseil/abseil-cpp/blame/c6b27359c3d27438b1313dddd7598914c1274a50/absl/crc/internal/crc_x86_arm_combined.cc#L370C3-L370C21</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Performance critical core libraries could be highly-optimized for arch
or micro-arch features. For instance, the absl crc library specializes
different templated classes among different hardwares [1]. In a
practical setting, it's likely that instrumented profiles are collected
on one type of machine and used to optimize binaries that run on
multiple types of hardwares.

While this kind of specialization is rare in terms of lines of code,
compiler can do a better job to skip vtable-based ICP.
* The per-class `Extend` implementation is arch-specific as well. If an
instrumented profile is collected on one arch and applied to another
arch where `Extend` implementation is different, `Extend` might be
regarded as unlikely function in the latter case. `ABSL_ATTRIBUTE_HOT`
annotation alleviates the problem by putting all `Extend` implementation
into the hot text section [2]

This change introduces a comma-separated list to specify the mangled
vtable names, and ICP pass will skip vtable-based comparison if a vtable
variable definition is shown to be in its class hierarchy (per LLVM type
metadata).

[1]
https://github.com/abseil/abseil-cpp/blob/c6b27359c3d27438b1313dddd7598914c1274a50/absl/crc/internal/crc_x86_arm_combined.cc#L621-L650
[2]
https://github.com/abseil/abseil-cpp/blame/c6b27359c3d27438b1313dddd7598914c1274a50/absl/crc/internal/crc_x86_arm_combined.cc#L370C3-L370C21</pre>
</div>
</content>
</entry>
<entry>
<title>[Instrumentation] Move out to Utils (NFC) (#108532)</title>
<updated>2024-09-16T04:07:40+00:00</updated>
<author>
<name>Antonio Frighetto</name>
<email>10052132+antoniofrighetto@users.noreply.github.com</email>
</author>
<published>2024-09-16T04:07:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=2ae968a0d9fb61606b020e898d884c82dd0ed8b5'/>
<id>2ae968a0d9fb61606b020e898d884c82dd0ed8b5</id>
<content type='text'>
Utility functions have been moved out to Utils. Minor opportunity to
drop the header where not needed.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Utility functions have been moved out to Utils. Minor opportunity to
drop the header where not needed.</pre>
</div>
</content>
</entry>
<entry>
<title>[ICP] Fix warnings</title>
<updated>2024-08-27T19:37:06+00:00</updated>
<author>
<name>Kazu Hirata</name>
<email>kazu@google.com</email>
</author>
<published>2024-08-27T19:37:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=2bdc0da4d7a26ab023ee03b877fb4a3e4beb070c'/>
<id>2bdc0da4d7a26ab023ee03b877fb4a3e4beb070c</id>
<content type='text'>
This patch fixes:

  llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp:845:12:
  error: variable 'RemainingVTableCount' set but not used
  [-Werror,-Wunused-but-set-variable]

  llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp:306:23:
  error: private field 'PSI' is not used
  [-Werror,-Wunused-private-field]

Here are a couple of domino effects:

- Once I remove PSI, I need to update the contructor and its caller.

- Once I remove RemainingVTableCount, I don't need TotalCount, so I am
  updating the caller as well.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch fixes:

  llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp:845:12:
  error: variable 'RemainingVTableCount' set but not used
  [-Werror,-Wunused-but-set-variable]

  llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp:306:23:
  error: private field 'PSI' is not used
  [-Werror,-Wunused-private-field]

Here are a couple of domino effects:

- Once I remove PSI, I need to update the contructor and its caller.

- Once I remove RemainingVTableCount, I don't need TotalCount, so I am
  updating the caller as well.
</pre>
</div>
</content>
</entry>
<entry>
<title>[TypeProf][ICP]Allow vtable-comparison as long as vtable count is comparable with function count for each candidate (#106260)</title>
<updated>2024-08-27T18:51:24+00:00</updated>
<author>
<name>Mingming Liu</name>
<email>mingmingl@google.com</email>
</author>
<published>2024-08-27T18:51:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=511500e35159fb770f6a570f473beeb78d4091a4'/>
<id>511500e35159fb770f6a570f473beeb78d4091a4</id>
<content type='text'>
The current cost-benefit analysis between vtable comparison and function
comparison require the indirect fallback branch to be cold. This is too
conservative.

This change allows vtable-comparison as long as vtable count is
comparable with function count for each function candidate and removes
the cold indirect fallback requirement.

Tested:
1. Testing this on benchmarks uplifts the measurable performance wins.
Counting the (possibly-duplicated) remarks (because of linkonce_odr
functions, cross-module import of functions) show the number of vtable
remarks increases from ~30k-ish to 50k-ish.
2. https://gcc.godbolt.org/z/sbGK7Pacn shows vtable-comparison doesn't
happen today (using the same IR input)</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The current cost-benefit analysis between vtable comparison and function
comparison require the indirect fallback branch to be cold. This is too
conservative.

This change allows vtable-comparison as long as vtable count is
comparable with function count for each function candidate and removes
the cold indirect fallback requirement.

Tested:
1. Testing this on benchmarks uplifts the measurable performance wins.
Counting the (possibly-duplicated) remarks (because of linkonce_odr
functions, cross-module import of functions) show the number of vtable
remarks increases from ~30k-ish to 50k-ish.
2. https://gcc.godbolt.org/z/sbGK7Pacn shows vtable-comparison doesn't
happen today (using the same IR input)</pre>
</div>
</content>
</entry>
<entry>
<title>[IndirectCallPromotion] Migrate to a new version of getValueProfDataFromInst (#97357)</title>
<updated>2024-07-02T02:01:10+00:00</updated>
<author>
<name>Kazu Hirata</name>
<email>kazu@google.com</email>
</author>
<published>2024-07-02T02:01:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=a07909ff11327baa72a4644dca7c6951ac6be902'/>
<id>a07909ff11327baa72a4644dca7c6951ac6be902</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[IndirectCallPromotion] Use ArrayRef&lt;PromotionCandidate&gt; (NFC) (#97236)</title>
<updated>2024-07-01T21:47:21+00:00</updated>
<author>
<name>Kazu Hirata</name>
<email>kazu@google.com</email>
</author>
<published>2024-07-01T21:47:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=1dc5000cf83a013fc79cc1fa1a215f014ac77451'/>
<id>1dc5000cf83a013fc79cc1fa1a215f014ac77451</id>
<content type='text'>
Aside from the fact that LLVM Programmer's Manual prefers ArrayRef to
const std::vector &amp;, ArrayRef&lt;PromotionCandidate&gt; here makes it easier
to switch the underlying type to something like SmallVector.  Note
that we typically do not have a lot of candidates.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Aside from the fact that LLVM Programmer's Manual prefers ArrayRef to
const std::vector &amp;, ArrayRef&lt;PromotionCandidate&gt; here makes it easier
to switch the underlying type to something like SmallVector.  Note
that we typically do not have a lot of candidates.</pre>
</div>
</content>
</entry>
</feed>
