<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/llvm/lib/Transforms/IPO/GlobalOpt.cpp, branch users/mingmingl-llvm/samplefdo-profile-format</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>[GlobalOpt] Fix unreachable ifunc globalopt crash (#157332) (#157593)</title>
<updated>2025-09-10T02:32:52+00:00</updated>
<author>
<name>Justin Riddell</name>
<email>arghnews@hotmail.co.uk</email>
</author>
<published>2025-09-10T02:32:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=cc052667b4b2f3bed12db68da876626e14f231f8'/>
<id>cc052667b4b2f3bed12db68da876626e14f231f8</id>
<content type='text'>
Also fixes (#131488)

Unreachable case is triggering `Callees.empty()` assert. Since this was
[originally
](https://github.com/llvm/llvm-project/pull/87939/commits/02bd5a7013c558f1e5220fc89bafa68f40276549#diff-06aba0dac2a263dc14297a15655291d5506b760f54a736385bcf3208f83df843R2524)
a `continue` anyway, have applied that as a fix and added a test case.
Please let me know if there's a better way.

Not sure who/how to get folks to review, tagging a few people (apologies
if you're not the right person/this is the wrong way to do it, please
let me know what to do in future if so)

@labrinea @dtcxzyw @nikic @fhahn</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Also fixes (#131488)

Unreachable case is triggering `Callees.empty()` assert. Since this was
[originally
](https://github.com/llvm/llvm-project/pull/87939/commits/02bd5a7013c558f1e5220fc89bafa68f40276549#diff-06aba0dac2a263dc14297a15655291d5506b760f54a736385bcf3208f83df843R2524)
a `continue` anyway, have applied that as a fix and added a test case.
Please let me know if there's a better way.

Not sure who/how to get folks to review, tagging a few people (apologies
if you're not the right person/this is the wrong way to do it, please
let me know what to do in future if so)

@labrinea @dtcxzyw @nikic @fhahn</pre>
</div>
</content>
</entry>
<entry>
<title>[GlobalOpt] Do not fold away addrspacecasts which may be runtime operations (#153753)</title>
<updated>2025-08-18T02:11:51+00:00</updated>
<author>
<name>Owen Anderson</name>
<email>resistor@mac.com</email>
</author>
<published>2025-08-18T02:11:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=69e4514978cf77e2a13b3feb868053e4ad65a7cd'/>
<id>69e4514978cf77e2a13b3feb868053e4ad65a7cd</id>
<content type='text'>
Specifically in the context of the once-stored transformation, GlobalOpt
would strip
all pointer casts unconditionally, even though addrspacecasts might be
runtime operations.
This manifested particularly on CHERI targets.

This patch was inspired by an existing change in CHERI LLVM
(https://github.com/CHERIoT-Platform/llvm-project/commit/91afa60f17ea1b91e5cdba21a5c90400024b2b6a),
but has been reimplemented with updated conventions, and a testcase
constructed from scratch.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Specifically in the context of the once-stored transformation, GlobalOpt
would strip
all pointer casts unconditionally, even though addrspacecasts might be
runtime operations.
This manifested particularly on CHERI targets.

This patch was inspired by an existing change in CHERI LLVM
(https://github.com/CHERIoT-Platform/llvm-project/commit/91afa60f17ea1b91e5cdba21a5c90400024b2b6a),
but has been reimplemented with updated conventions, and a testcase
constructed from scratch.</pre>
</div>
</content>
</entry>
<entry>
<title>[NFC][Clang][FMV] Make FMV priority data type future proof. (#150079)</title>
<updated>2025-07-23T09:37:29+00:00</updated>
<author>
<name>Alexandros Lamprineas</name>
<email>alexandros.lamprineas@arm.com</email>
</author>
<published>2025-07-23T09:37:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=3ab64c5b29643f8d10e5e6286f7a1b9f0f2c0792'/>
<id>3ab64c5b29643f8d10e5e6286f7a1b9f0f2c0792</id>
<content type='text'>
FMV priority is the returned value of a polymorphic function. On RISC-V
and X86 targets a 32-bit value is enough. On AArch64 we currently need
64 bits and we will soon exceed that. APInt seems to be a suitable
replacement for uint64_t, presumably with minimal compile time overhead.
It allows bit manipulation, comparison and variable bit width.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
FMV priority is the returned value of a polymorphic function. On RISC-V
and X86 targets a 32-bit value is enough. On AArch64 we currently need
64 bits and we will soon exceed that. APInt seems to be a suitable
replacement for uint64_t, presumably with minimal compile time overhead.
It allows bit manipulation, comparison and variable bit width.</pre>
</div>
</content>
</entry>
<entry>
<title>[DebugInfo][RemoveDIs] Suppress getNextNonDebugInfoInstruction (#144383)</title>
<updated>2025-07-15T14:34:10+00:00</updated>
<author>
<name>Jeremy Morse</name>
<email>jeremy.morse@sony.com</email>
</author>
<published>2025-07-15T14:34:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=57a5f9c47e063701ac7d13a5efd993e839e148eb'/>
<id>57a5f9c47e063701ac7d13a5efd993e839e148eb</id>
<content type='text'>
There are no longer debug-info instructions, thus we don't need this
skipping. Horray!</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There are no longer debug-info instructions, thus we don't need this
skipping. Horray!</pre>
</div>
</content>
</entry>
<entry>
<title>[GlobalOpt] Revert global widening transform (#144652)</title>
<updated>2025-06-30T12:48:37+00:00</updated>
<author>
<name>Nikita Popov</name>
<email>npopov@redhat.com</email>
</author>
<published>2025-06-30T12:48:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=183acdd27985afd332463e3d9fd4a2ca46d85cf1'/>
<id>183acdd27985afd332463e3d9fd4a2ca46d85cf1</id>
<content type='text'>
Partially reverts e37d736def5b95a2710f92881b5fc8b0494d8a05.

The transform has a number of correctness and code quality issues, and
will benefit from a from-scratch re-review more than incremental fixes.

The correctness issues are hinted at in
https://github.com/llvm/llvm-project/pull/144641, but I think it needs a
larger rework to stop working on ArrayTypes and the implementation could
use some other improvements (like callInstIsMemcpy should just be
`dyn_cast&lt;MemCpyInst&gt;`). I can comment in more detail on a resubmission
of the patch.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Partially reverts e37d736def5b95a2710f92881b5fc8b0494d8a05.

The transform has a number of correctness and code quality issues, and
will benefit from a from-scratch re-review more than incremental fixes.

The correctness issues are hinted at in
https://github.com/llvm/llvm-project/pull/144641, but I think it needs a
larger rework to stop working on ArrayTypes and the implementation could
use some other improvements (like callInstIsMemcpy should just be
`dyn_cast&lt;MemCpyInst&gt;`). I can comment in more detail on a resubmission
of the patch.</pre>
</div>
</content>
</entry>
<entry>
<title>[Transforms] Use range-based for loops (NFC) (#145252)</title>
<updated>2025-06-25T17:08:26+00:00</updated>
<author>
<name>Kazu Hirata</name>
<email>kazu@google.com</email>
</author>
<published>2025-06-25T17:08:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=2a35414e9888f80a6c7073a503b0a7a13635a71a'/>
<id>2a35414e9888f80a6c7073a503b0a7a13635a71a</id>
<content type='text'>
Co-authored-by: Matt Arsenault &lt;arsenm2@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Co-authored-by: Matt Arsenault &lt;arsenm2@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>[GlobalOpt] Use cast instead of dyn_cast. NFC (#144634)</title>
<updated>2025-06-18T08:35:56+00:00</updated>
<author>
<name>Craig Topper</name>
<email>craig.topper@sifive.com</email>
</author>
<published>2025-06-18T08:35:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=255b55c602f73964262893859a543a115b278e21'/>
<id>255b55c602f73964262893859a543a115b278e21</id>
<content type='text'>
The dyn_cast was not checked for null, and the cast is guaranteed to
succeed by an earlier check.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The dyn_cast was not checked for null, and the cast is guaranteed to
succeed by an earlier check.</pre>
</div>
</content>
</entry>
<entry>
<title>[DLCov][NFC] Annotate intentionally-blank DebugLocs in existing code (#136192)</title>
<updated>2025-06-11T16:42:10+00:00</updated>
<author>
<name>Stephen Tozer</name>
<email>stephen.tozer@sony.com</email>
</author>
<published>2025-06-11T16:42:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=aa8a1fa6f515f45db55365b9c1f8453ded24ed32'/>
<id>aa8a1fa6f515f45db55365b9c1f8453ded24ed32</id>
<content type='text'>
Following the work in PR #107279, this patch applies the annotative
DebugLocs, which indicate that a particular instruction is intentionally
missing a location for a given reason, to existing sites in the compiler
where their conditions apply. This is NFC in ordinary LLVM builds (each
function `DebugLoc::getFoo()` is inlined as `DebugLoc()`), but marks the
instruction in coverage-tracking builds so that it will be ignored by
Debugify, allowing only real errors to be reported. From a developer
standpoint, it also communicates the intentionality and reason for a
missing DebugLoc.

Some notes for reviewers:

- The difference between `I-&gt;dropLocation()` and
`I-&gt;setDebugLoc(DebugLoc::getDropped())` is that the former _may_ decide
to keep some debug info alive, while the latter will always be empty; in
this patch, I always used the latter (even if the former could
technically be correct), because the former could result in some
(barely) different output, and I'd prefer to keep this patch purely NFC.
- I've generally documented the uses of `DebugLoc::getUnknown()`, with
the exception of the vectorizers - in summary, they are a huge cause of
dropped source locations, and I don't have the time or the domain
knowledge currently to solve that, so I've plastered it all over them as
a form of "fixme".</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Following the work in PR #107279, this patch applies the annotative
DebugLocs, which indicate that a particular instruction is intentionally
missing a location for a given reason, to existing sites in the compiler
where their conditions apply. This is NFC in ordinary LLVM builds (each
function `DebugLoc::getFoo()` is inlined as `DebugLoc()`), but marks the
instruction in coverage-tracking builds so that it will be ignored by
Debugify, allowing only real errors to be reported. From a developer
standpoint, it also communicates the intentionality and reason for a
missing DebugLoc.

Some notes for reviewers:

- The difference between `I-&gt;dropLocation()` and
`I-&gt;setDebugLoc(DebugLoc::getDropped())` is that the former _may_ decide
to keep some debug info alive, while the latter will always be empty; in
this patch, I always used the latter (even if the former could
technically be correct), because the former could result in some
(barely) different output, and I'd prefer to keep this patch purely NFC.
- I've generally documented the uses of `DebugLoc::getUnknown()`, with
the exception of the vectorizers - in summary, they are a huge cause of
dropped source locations, and I don't have the time or the domain
knowledge currently to solve that, so I've plastered it all over them as
a form of "fixme".</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>[GlobalOpt] Do not promote malloc if there are atomic loads/stores (#137158)</title>
<updated>2025-04-24T13:15:47+00:00</updated>
<author>
<name>Nikita Popov</name>
<email>npopov@redhat.com</email>
</author>
<published>2025-04-24T13:15:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=57530c23a53b5e003d389437637f61c5b9814e22'/>
<id>57530c23a53b5e003d389437637f61c5b9814e22</id>
<content type='text'>
When converting a malloc stored to a global into a global, we will
introduce an i1 flag to track whether the global has been initialized.

In case of atomic loads/stores, this will result in verifier failures,
because atomic ops on i1 are illegal. Even if we changed this to i8, I
don't think it is a good idea to change atomic types in that way.

Instead, bail out of the transform is we encounter any atomic
loads/stores of the global.

Fixes https://github.com/llvm/llvm-project/issues/137152.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When converting a malloc stored to a global into a global, we will
introduce an i1 flag to track whether the global has been initialized.

In case of atomic loads/stores, this will result in verifier failures,
because atomic ops on i1 are illegal. Even if we changed this to i8, I
don't think it is a good idea to change atomic types in that way.

Instead, bail out of the transform is we encounter any atomic
loads/stores of the global.

Fixes https://github.com/llvm/llvm-project/issues/137152.</pre>
</div>
</content>
</entry>
</feed>
