<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/llvm/lib/Analysis/MemorySSAUpdater.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>[MemorySSA] Don't create phi nodes in fixupDefs() (#156021)</title>
<updated>2025-09-04T08:23:29+00:00</updated>
<author>
<name>Nikita Popov</name>
<email>npopov@redhat.com</email>
</author>
<published>2025-09-04T08:23:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=d1408667de830da8817c24cb9788da6caae551c7'/>
<id>d1408667de830da8817c24cb9788da6caae551c7</id>
<content type='text'>
The general flow when inserting MemoryDefs is:

 * Insert the def and set it's defining access (may insert phis)
 * Insert IDF phis
 * Update defining access for defs after the new one (fixupDefs)
 * Rename uses if requested

fixupDefs() uses getPreviousDef() which can create new MemoryPHIs, but
for which we're not going to insert IDF phis, so the required dominance
property may not hold.

I believe this is a leftover from a time before the "Insert IDF phis"
step existed. Now that step should already ensure that all necessary
MemoryPhis have been inserted, and we only need to update them.

The fixupDefs() implementation was also returning after updating a
single access, which is not right.

Fixes https://github.com/llvm/llvm-project/issues/47875.
Fixes https://github.com/llvm/llvm-project/issues/117157.
Fixes https://github.com/llvm/llvm-project/issues/152998.
Fixes https://github.com/llvm/llvm-project/issues/155161.
Fixes https://github.com/llvm/llvm-project/issues/155184.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The general flow when inserting MemoryDefs is:

 * Insert the def and set it's defining access (may insert phis)
 * Insert IDF phis
 * Update defining access for defs after the new one (fixupDefs)
 * Rename uses if requested

fixupDefs() uses getPreviousDef() which can create new MemoryPHIs, but
for which we're not going to insert IDF phis, so the required dominance
property may not hold.

I believe this is a leftover from a time before the "Insert IDF phis"
step existed. Now that step should already ensure that all necessary
MemoryPhis have been inserted, and we only need to update them.

The fixupDefs() implementation was also returning after updating a
single access, which is not right.

Fixes https://github.com/llvm/llvm-project/issues/47875.
Fixes https://github.com/llvm/llvm-project/issues/117157.
Fixes https://github.com/llvm/llvm-project/issues/152998.
Fixes https://github.com/llvm/llvm-project/issues/155161.
Fixes https://github.com/llvm/llvm-project/issues/155184.</pre>
</div>
</content>
</entry>
<entry>
<title>[MemorySSAUpdater] Fix iterator invalidation bug in `applyInsertUpdates` (#139370)</title>
<updated>2025-05-10T13:48:26+00:00</updated>
<author>
<name>Yingwei Zheng</name>
<email>dtcxzyw2333@gmail.com</email>
</author>
<published>2025-05-10T13:48:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=05f1e313948768fdd8527969cd79809cbd0654ff'/>
<id>05f1e313948768fdd8527969cd79809cbd0654ff</id>
<content type='text'>
This patch defers resetting optimized accesses until all uses are
replaced, to avoid invalidating the iterator.

Closes https://github.com/llvm/llvm-project/issues/139103.
Closes https://github.com/llvm/llvm-project/issues/139289.
Closes https://github.com/llvm/llvm-project/issues/139308.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch defers resetting optimized accesses until all uses are
replaced, to avoid invalidating the iterator.

Closes https://github.com/llvm/llvm-project/issues/139103.
Closes https://github.com/llvm/llvm-project/issues/139289.
Closes https://github.com/llvm/llvm-project/issues/139308.</pre>
</div>
</content>
</entry>
<entry>
<title>[llvm] Use range constructors of *Set (NFC) (#137552)</title>
<updated>2025-04-27T22:59:57+00:00</updated>
<author>
<name>Kazu Hirata</name>
<email>kazu@google.com</email>
</author>
<published>2025-04-27T22:59:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=5cfd81b0cc9f92f3d4903f4e7b97769fe7b565b9'/>
<id>5cfd81b0cc9f92f3d4903f4e7b97769fe7b565b9</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[llvm] Use range constructors of *Set (NFC) (#133549)</title>
<updated>2025-03-29T02:55:18+00:00</updated>
<author>
<name>Kazu Hirata</name>
<email>kazu@google.com</email>
</author>
<published>2025-03-29T02:55:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=d4427f308eb6e42790a36b56d61b482cbc9f67ba'/>
<id>d4427f308eb6e42790a36b56d61b482cbc9f67ba</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[Analysis] Use *Set::insert_range (NFC) (#132878)</title>
<updated>2025-03-25T14:51:39+00:00</updated>
<author>
<name>Kazu Hirata</name>
<email>kazu@google.com</email>
</author>
<published>2025-03-25T14:51:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=1617f90a6154dfd59e58da8b9513d903d899169a'/>
<id>1617f90a6154dfd59e58da8b9513d903d899169a</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>[MemorySSA] Handle MemoryDef optimized away during cloning (#117883)</title>
<updated>2024-12-09T11:21:49+00:00</updated>
<author>
<name>Nikita Popov</name>
<email>npopov@redhat.com</email>
</author>
<published>2024-12-09T11:21:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=46e04f7fe5c0f01ba452489bb966bdf2d560a63d'/>
<id>46e04f7fe5c0f01ba452489bb966bdf2d560a63d</id>
<content type='text'>
When determining the replacement access during cloning, we currently
leave accesses for instructions that are not in the VMap alone. This is
correct if the instruction is not in VMap because it hasn't been cloned,
but not if it has been cloned and then removed. In that case, we should
walk up to the defining access, like in other simplification cases.

To distinguish the two cases, pass in a callback that queries whether
the instruction is part of the cloned region.

An alternative to this would be to delay removal of dead instructions in
SimpleLoopUnswitch until after MSSA cloning.

Fixes https://github.com/llvm/llvm-project/issues/116228.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When determining the replacement access during cloning, we currently
leave accesses for instructions that are not in the VMap alone. This is
correct if the instruction is not in VMap because it hasn't been cloned,
but not if it has been cloned and then removed. In that case, we should
walk up to the defining access, like in other simplification cases.

To distinguish the two cases, pass in a callback that queries whether
the instruction is part of the cloned region.

An alternative to this would be to delay removal of dead instructions in
SimpleLoopUnswitch until after MSSA cloning.

Fixes https://github.com/llvm/llvm-project/issues/116228.</pre>
</div>
</content>
</entry>
<entry>
<title>[LICM] allow MemoryAccess creation failure (#116813)</title>
<updated>2024-11-20T11:52:51+00:00</updated>
<author>
<name>DianQK</name>
<email>dianqk@dianqk.net</email>
</author>
<published>2024-11-20T11:52:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=18b02bbf441660683df7f3925946984203d49bab'/>
<id>18b02bbf441660683df7f3925946984203d49bab</id>
<content type='text'>
Fixes #116809.

After running some passes (SimpleLoopUnswitch, LoopInstSimplify, etc.),
MemorySSA might be outdated, and the instruction `I` may have become a
non-memory touching instruction.

LICM has already handled this, but it does not pass
`CreationMustSucceed=false` to `createDefinedAccess`.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes #116809.

After running some passes (SimpleLoopUnswitch, LoopInstSimplify, etc.),
MemorySSA might be outdated, and the instruction `I` may have become a
non-memory touching instruction.

LICM has already handled this, but it does not pass
`CreationMustSucceed=false` to `createDefinedAccess`.</pre>
</div>
</content>
</entry>
<entry>
<title>[MSSAUpdater] Handle simplified accesses when updating phis (#78272)</title>
<updated>2024-01-24T09:15:42+00:00</updated>
<author>
<name>Nikita Popov</name>
<email>npopov@redhat.com</email>
</author>
<published>2024-01-24T09:15:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=a7a1b8b17e264fb0f2d2b4165cf9a7f5094b08b3'/>
<id>a7a1b8b17e264fb0f2d2b4165cf9a7f5094b08b3</id>
<content type='text'>
This is a followup to #76819. After those changes, we can still run into
an assertion failure for a slight variation of the test case: When
fixing up MemoryPhis, we map the incoming access to the access of the
cloned instruction -- which may now no longer exist.

Fix this by reusing the getNewDefiningAccessForClone() helper, which
will look upwards for a new defining access in that case.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is a followup to #76819. After those changes, we can still run into
an assertion failure for a slight variation of the test case: When
fixing up MemoryPhis, we map the incoming access to the access of the
cloned instruction -- which may now no longer exist.

Fix this by reusing the getNewDefiningAccessForClone() helper, which
will look upwards for a new defining access in that case.</pre>
</div>
</content>
</entry>
<entry>
<title>[MSSA] Don't require clone creation to succeed (#76819)</title>
<updated>2024-01-08T09:21:25+00:00</updated>
<author>
<name>Nikita Popov</name>
<email>npopov@redhat.com</email>
</author>
<published>2024-01-08T09:21:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=d02c7931d1be794a230943e300fec4172032e6a8'/>
<id>d02c7931d1be794a230943e300fec4172032e6a8</id>
<content type='text'>
Sometimes, we create a MemoryAccess for an instruction, which is later
simplified (e.g. via devirtualization) such that the new instruction has
no memory effects anymore.

If we later clone the instruction (e.g. during unswitching), then MSSA
will not create a MemoryAccess for the new instruction, triggering an
assert.

Disable the assertion (by passing CreationMustSucceed=false) and adjust
getDefiningAccessForClone() to work correctly in that case.

This PR implements the alternative suggestion by alinas from
https://github.com/llvm/llvm-project/pull/76142.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Sometimes, we create a MemoryAccess for an instruction, which is later
simplified (e.g. via devirtualization) such that the new instruction has
no memory effects anymore.

If we later clone the instruction (e.g. during unswitching), then MSSA
will not create a MemoryAccess for the new instruction, triggering an
assert.

Disable the assertion (by passing CreationMustSucceed=false) and adjust
getDefiningAccessForClone() to work correctly in that case.

This PR implements the alternative suggestion by alinas from
https://github.com/llvm/llvm-project/pull/76142.</pre>
</div>
</content>
</entry>
<entry>
<title>[Analysis] Qualify auto variables in for loops (NFC)</title>
<updated>2022-07-17T06:26:34+00:00</updated>
<author>
<name>Kazu Hirata</name>
<email>kazu@google.com</email>
</author>
<published>2022-07-17T06:26:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=601b3a13dea746e2b1e683bbbece41ae9de76c2b'/>
<id>601b3a13dea746e2b1e683bbbece41ae9de76c2b</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
