<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/llvm/lib/Transforms/IPO/PartialInlining.cpp, branch main</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>[Coroutines] Conditional elide coroutines based on hot/cold information (#162276)</title>
<updated>2025-10-09T15:31:44+00:00</updated>
<author>
<name>Adrian Vogelsgesang</name>
<email>avogelsgesang@salesforce.com</email>
</author>
<published>2025-10-09T15:31:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=c4f36758b73fbf651650d8b650347e0ac172795f'/>
<id>c4f36758b73fbf651650d8b650347e0ac172795f</id>
<content type='text'>
Unconditionally eliding all `[[clang::coro_await_elidable]]` coroutines
is not good.

For example,

```
Task bar();
Task foo(bool b) {
     if (b) [[unlikely]] {
         co_await bar();
     }
}
```

Assume Task is marked with `[[clang::coro_await_elidable]]`, now we will
always elide the call to `bar()` into the frame of `foo()`. But this may
be a regression instead of an optimization if `b` is always false.

This patch tries to mitigate the problem by leveraging hot/cold
information. This can be optimized further in the future but at least
this patch makes things better.

This patch was originally written by ChuanqiXu9 (#145831), but stalled
during PR review because the diagnostics were not integrated with
the existing optimization remarks. I rebased the original patch,
integrated it with the optimization remarks, and did a couple of smaller
cosmetic changes (e.g., made the test case expectations more
targeted, etc.)

Co-Authored-by: Chuanqi Xu &lt;yedeng.yd@linux.alibaba.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Unconditionally eliding all `[[clang::coro_await_elidable]]` coroutines
is not good.

For example,

```
Task bar();
Task foo(bool b) {
     if (b) [[unlikely]] {
         co_await bar();
     }
}
```

Assume Task is marked with `[[clang::coro_await_elidable]]`, now we will
always elide the call to `bar()` into the frame of `foo()`. But this may
be a regression instead of an optimization if `b` is always false.

This patch tries to mitigate the problem by leveraging hot/cold
information. This can be optimized further in the future but at least
this patch makes things better.

This patch was originally written by ChuanqiXu9 (#145831), but stalled
during PR review because the diagnostics were not integrated with
the existing optimization remarks. I rebased the original patch,
integrated it with the optimization remarks, and did a couple of smaller
cosmetic changes (e.g., made the test case expectations more
targeted, etc.)

Co-Authored-by: Chuanqi Xu &lt;yedeng.yd@linux.alibaba.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>[IR] Do not store Function inside BlockAddress (#137958)</title>
<updated>2025-05-02T07:40:50+00:00</updated>
<author>
<name>Nikita Popov</name>
<email>npopov@redhat.com</email>
</author>
<published>2025-05-02T07:40:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=4109bac3301eb7b7033eec3c8e8107be8cad9bc9'/>
<id>4109bac3301eb7b7033eec3c8e8107be8cad9bc9</id>
<content type='text'>
Currently BlockAddresses store both the Function and the BasicBlock they
reference, and the BlockAddress is part of the use list of both the
Function and BasicBlock.

This is quite awkward, because this is not really a use of the function
itself (and walks of function uses generally skip block addresses for
that reason). This also has weird implications on function RAUW (as that
will replace the function in block addresses in a way that generally
doesn't make sense), and causes other peculiar issues, like the ability
to have multiple block addresses for one block (with different
functions).

Instead, I believe it makes more sense to specify only the basic block
and let the function be implied by the BB parent. This does mean that we
may have block addresses without a function (if the BB is not inserted),
but this should only happen during IR construction.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently BlockAddresses store both the Function and the BasicBlock they
reference, and the BlockAddress is part of the use list of both the
Function and BasicBlock.

This is quite awkward, because this is not really a use of the function
itself (and walks of function uses generally skip block addresses for
that reason). This also has weird implications on function RAUW (as that
will replace the function in block addresses in a way that generally
doesn't make sense), and causes other peculiar issues, like the ability
to have multiple block addresses for one block (with different
functions).

Instead, I believe it makes more sense to specify only the basic block
and let the function be implied by the BB parent. This does mean that we
may have block addresses without a function (if the BB is not inserted),
but this should only happen during IR construction.</pre>
</div>
</content>
</entry>
<entry>
<title>[CostModel] Remove optional from InstructionCost::getValue() (#135596)</title>
<updated>2025-04-23T06:46:27+00:00</updated>
<author>
<name>David Green</name>
<email>david.green@arm.com</email>
</author>
<published>2025-04-23T06:46:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=98b6f8dc699d789d834e5b6d810ed217f560aad0'/>
<id>98b6f8dc699d789d834e5b6d810ed217f560aad0</id>
<content type='text'>
InstructionCost is already an optional value, containing an Invalid
state that can be checked with isValid(). There is little point in
returning another optional from getValue(). Most uses do not make use of
it being a std::optional, dereferencing the value directly (either
isValid has been checked previously or the Cost is assumed to be valid).
The one case that does in AMDGPU used value_or which has been replaced
by a isValid() check.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
InstructionCost is already an optional value, containing an Invalid
state that can be checked with isValid(). There is little point in
returning another optional from getValue(). Most uses do not make use of
it being a std::optional, dereferencing the value directly (either
isValid has been checked previously or the Cost is assumed to be valid).
The one case that does in AMDGPU used value_or which has been replaced
by a isValid() check.</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>[IPO] Avoid repeated hash lookups (NFC) (#127957)</title>
<updated>2025-02-20T16:55:52+00:00</updated>
<author>
<name>Kazu Hirata</name>
<email>kazu@google.com</email>
</author>
<published>2025-02-20T16:55:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=506b31ec36746732b84fb0e9cd74af3ca885fa86'/>
<id>506b31ec36746732b84fb0e9cd74af3ca885fa86</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[PartialInlining] Use DenseSet instead of DenseMap (NFC) (#127170)</title>
<updated>2025-02-14T10:33:45+00:00</updated>
<author>
<name>Kazu Hirata</name>
<email>kazu@google.com</email>
</author>
<published>2025-02-14T10:33:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=d3d2ea67585f119c99af66a343f19f237891890e'/>
<id>d3d2ea67585f119c99af66a343f19f237891890e</id>
<content type='text'>
This patch changes the type of VisitedMap to DenseSet from DenseMap
because the value side of the map is always "true".

Technically:

  if (VisitedMap[*SI])

inserts "false" as a value, but the value is immediately overridden
with:

  VisitedMap[*SI] = true;

While we are at it, this patch removes the repeated hash lookups
around the "if" statement.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch changes the type of VisitedMap to DenseSet from DenseMap
because the value side of the map is always "true".

Technically:

  if (VisitedMap[*SI])

inserts "false" as a value, but the value is immediately overridden
with:

  VisitedMap[*SI] = true;

While we are at it, this patch removes the repeated hash lookups
around the "if" statement.</pre>
</div>
</content>
</entry>
<entry>
<title>[NFC][DebugInfo] Use iterator-flavour getFirstNonPHI at many call-sites (#123737)</title>
<updated>2025-01-24T13:27:56+00:00</updated>
<author>
<name>Jeremy Morse</name>
<email>jeremy.morse@sony.com</email>
</author>
<published>2025-01-24T13:27:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=6292a808b3524d9ba6f4ce55bc5b9e547b088dd8'/>
<id>6292a808b3524d9ba6f4ce55bc5b9e547b088dd8</id>
<content type='text'>
As part of the "RemoveDIs" project, BasicBlock::iterator now carries a
debug-info bit that's needed when getFirstNonPHI and similar feed into
instruction insertion positions. Call-sites where that's necessary were
updated a year ago; but to ensure some type safety however, we'd like to
have all calls to getFirstNonPHI use the iterator-returning version.

This patch changes a bunch of call-sites calling getFirstNonPHI to use
getFirstNonPHIIt, which returns an iterator. All these call sites are
where it's obviously safe to fetch the iterator then dereference it. A
follow-up patch will contain less-obviously-safe changes.

We'll eventually deprecate and remove the instruction-pointer
getFirstNonPHI, but not before adding concise documentation of what
considerations are needed (very few).

---------

Co-authored-by: Stephen Tozer &lt;Melamoto@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As part of the "RemoveDIs" project, BasicBlock::iterator now carries a
debug-info bit that's needed when getFirstNonPHI and similar feed into
instruction insertion positions. Call-sites where that's necessary were
updated a year ago; but to ensure some type safety however, we'd like to
have all calls to getFirstNonPHI use the iterator-returning version.

This patch changes a bunch of call-sites calling getFirstNonPHI to use
getFirstNonPHIIt, which returns an iterator. All these call sites are
where it's obviously safe to fetch the iterator then dereference it. A
follow-up patch will contain less-obviously-safe changes.

We'll eventually deprecate and remove the instruction-pointer
getFirstNonPHI, but not before adding concise documentation of what
considerations are needed (very few).

---------

Co-authored-by: Stephen Tozer &lt;Melamoto@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>[Transforms] Construct SmallVector with ArrayRef (NFC) (#101851)</title>
<updated>2024-08-03T22:33:08+00:00</updated>
<author>
<name>Kazu Hirata</name>
<email>kazu@google.com</email>
</author>
<published>2024-08-03T22:33:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=b7146aed5b99e6f858f6c7243a2a38406bb41d1c'/>
<id>b7146aed5b99e6f858f6c7243a2a38406bb41d1c</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "[Inliner] Fix bugs for partial inlining with vector"</title>
<updated>2024-08-01T12:16:36+00:00</updated>
<author>
<name>joshua-arch1</name>
<email>68843032+joshua-arch1@users.noreply.github.com</email>
</author>
<published>2024-08-01T12:16:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=241a05af0c2324eb073747d42466b9dde229655f'/>
<id>241a05af0c2324eb073747d42466b9dde229655f</id>
<content type='text'>
This reverts commit https://github.com/llvm/llvm-project/commit/0a5e5728fbb61d7c775aabc8048b7b629e9ca2d2,
since I forgot to start a pull request.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit https://github.com/llvm/llvm-project/commit/0a5e5728fbb61d7c775aabc8048b7b629e9ca2d2,
since I forgot to start a pull request.</pre>
</div>
</content>
</entry>
<entry>
<title>[Inliner] Fix bugs for partial inlining with vector</title>
<updated>2024-08-01T12:07:08+00:00</updated>
<author>
<name>joshua-arch1</name>
<email>68843032+joshua-arch1@users.noreply.github.com</email>
</author>
<published>2024-08-01T12:07:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=0a5e5728fbb61d7c775aabc8048b7b629e9ca2d2'/>
<id>0a5e5728fbb61d7c775aabc8048b7b629e9ca2d2</id>
<content type='text'>
In the cost model of partial inlining, cost for intrinsics will be applied. However, some intrinsics for vector have invalid cost, which is not allowed for partial inlining. Instead of assertion, we directly do not do partial inlining  in this circumstance to avoid compiling errors.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In the cost model of partial inlining, cost for intrinsics will be applied. However, some intrinsics for vector have invalid cost, which is not allowed for partial inlining. Instead of assertion, we directly do not do partial inlining  in this circumstance to avoid compiling errors.</pre>
</div>
</content>
</entry>
</feed>
