<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/llvm/test/Transforms/LoopPredication, 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>[SimpleLoopUnswitch] Don't use BlockFrequencyInfo to skip cold loops (#159522)</title>
<updated>2025-10-17T23:33:49+00:00</updated>
<author>
<name>Luke Lau</name>
<email>luke@igalia.com</email>
</author>
<published>2025-10-17T23:33:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=df8956442feda0171fda79393778f698eb0385cf'/>
<id>df8956442feda0171fda79393778f698eb0385cf</id>
<content type='text'>
In https://reviews.llvm.org/D129599, non-trivial switching was disabled
for cold loops in the interest of code size. This added a dependency on
BlockFrequencyInfo with PGO, but in loop passes this is only available
on a lossy basis: see https://reviews.llvm.org/D86156

LICM moved away from BFI so as of today SimpleLoopUnswitch is the only
remaining loop pass that uses BFI, for the sole reason to prevent code
size increases in PGO builds. It doesn't use BFI if there's no profile
summary available.

After some investigation on llvm-test-suite it turns out that the lossy
BFI causes very significant deviations in block frequency, since when
new loops are deleted/created during the loop pass manager it can return
frequencies for different loops altogether.
This results in unswitchable loops being mistakenly skipped because they
are thought to be cold.

This patch removes the use of BFI from SimpleLoopUnswitch and thus the
last remaining use of BFI in a loop pass.

To recover the original intent of not unswitching cold code,
PGOForceFunctionAttrs can be used to annotate functions which can be
optimized for code size, since SimpleLoopUnswitch will respect OptSize:
https://reviews.llvm.org/D94559

This isn't 100% the same behaviour since the previous behaviour checked
for coldness at the loop level and this is now at the function level. We
could expand PGOForceFunctionAttrs to be more granular at the loop
level, https://github.com/llvm/llvm-project/issues/159595 tracks this
idea.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In https://reviews.llvm.org/D129599, non-trivial switching was disabled
for cold loops in the interest of code size. This added a dependency on
BlockFrequencyInfo with PGO, but in loop passes this is only available
on a lossy basis: see https://reviews.llvm.org/D86156

LICM moved away from BFI so as of today SimpleLoopUnswitch is the only
remaining loop pass that uses BFI, for the sole reason to prevent code
size increases in PGO builds. It doesn't use BFI if there's no profile
summary available.

After some investigation on llvm-test-suite it turns out that the lossy
BFI causes very significant deviations in block frequency, since when
new loops are deleted/created during the loop pass manager it can return
frequencies for different loops altogether.
This results in unswitchable loops being mistakenly skipped because they
are thought to be cold.

This patch removes the use of BFI from SimpleLoopUnswitch and thus the
last remaining use of BFI in a loop pass.

To recover the original intent of not unswitching cold code,
PGOForceFunctionAttrs can be used to annotate functions which can be
optimized for code size, since SimpleLoopUnswitch will respect OptSize:
https://reviews.llvm.org/D94559

This isn't 100% the same behaviour since the previous behaviour checked
for coldness at the loop level and this is now at the function level. We
could expand PGOForceFunctionAttrs to be more granular at the loop
level, https://github.com/llvm/llvm-project/issues/159595 tracks this
idea.</pre>
</div>
</content>
</entry>
<entry>
<title>[IR] Convert from nocapture to captures(none) (#123181)</title>
<updated>2025-01-29T15:56:47+00:00</updated>
<author>
<name>Nikita Popov</name>
<email>npopov@redhat.com</email>
</author>
<published>2025-01-29T15:56:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=29441e4f5fa5f5c7709f7cf180815ba97f611297'/>
<id>29441e4f5fa5f5c7709f7cf180815ba97f611297</id>
<content type='text'>
This PR removes the old `nocapture` attribute, replacing it with the new
`captures` attribute introduced in #116990. This change is
intended to be essentially NFC, replacing existing uses of `nocapture`
with `captures(none)` without adding any new analysis capabilities.
Making use of non-`none` values is left for a followup.

Some notes:
* `nocapture` will be upgraded to `captures(none)` by the bitcode
   reader.
* `nocapture` will also be upgraded by the textual IR reader. This is to
   make it easier to use old IR files and somewhat reduce the test churn in
   this PR.
* Helper APIs like `doesNotCapture()` will check for `captures(none)`.
* MLIR import will convert `captures(none)` into an `llvm.nocapture`
   attribute. The representation in the LLVM IR dialect should be updated
   separately.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This PR removes the old `nocapture` attribute, replacing it with the new
`captures` attribute introduced in #116990. This change is
intended to be essentially NFC, replacing existing uses of `nocapture`
with `captures(none)` without adding any new analysis capabilities.
Making use of non-`none` values is left for a followup.

Some notes:
* `nocapture` will be upgraded to `captures(none)` by the bitcode
   reader.
* `nocapture` will also be upgraded by the textual IR reader. This is to
   make it easier to use old IR files and somewhat reduce the test churn in
   this PR.
* Helper APIs like `doesNotCapture()` will check for `captures(none)`.
* MLIR import will convert `captures(none)` into an `llvm.nocapture`
   attribute. The representation in the LLVM IR dialect should be updated
   separately.</pre>
</div>
</content>
</entry>
<entry>
<title>[llvm] Remove `br i1 undef` from  some regression tests [NFC] (#117112)</title>
<updated>2024-11-21T08:06:56+00:00</updated>
<author>
<name>Lee Wei</name>
<email>lee10202013@gmail.com</email>
</author>
<published>2024-11-21T08:06:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=abb9f9fa06ef22be2b0287b9047d5cfed71d91d4'/>
<id>abb9f9fa06ef22be2b0287b9047d5cfed71d91d4</id>
<content type='text'>
This PR removes tests with `br i1 undef` under
`llvm/tests/Transforms/Loop*, Lower*`.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This PR removes tests with `br i1 undef` under
`llvm/tests/Transforms/Loop*, Lower*`.</pre>
</div>
</content>
</entry>
<entry>
<title>[StandardInstrumentation] Annotate loops with the function name (#90756)</title>
<updated>2024-05-03T18:13:59+00:00</updated>
<author>
<name>annamthomas</name>
<email>anna@azul.com</email>
</author>
<published>2024-05-03T18:13:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=46c2d936624322e141c6eff319e1ad2d25f1afd7'/>
<id>46c2d936624322e141c6eff319e1ad2d25f1afd7</id>
<content type='text'>
When analyzing pass debug output it is helpful to have the function name
along with the loop name.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When analyzing pass debug output it is helpful to have the function name
along with the loop name.</pre>
</div>
</content>
</entry>
<entry>
<title>[SCEVExpander] Attempt to reinfer flags dropped due to CSE (#72431)</title>
<updated>2023-12-07T21:20:36+00:00</updated>
<author>
<name>Philip Reames</name>
<email>preames@rivosinc.com</email>
</author>
<published>2023-12-07T21:20:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=ffb2af3ed6a95a4eb55b81a3d1351d5d4bd66eb5'/>
<id>ffb2af3ed6a95a4eb55b81a3d1351d5d4bd66eb5</id>
<content type='text'>
LSR uses SCEVExpander to generate induction formulas. The expander
internally tries to reuse existing IR expressions. To do that, it needs
to strip any poison generating flags (nsw, nuw, exact, nneg, etc..)
which may not be valid for the newly added users.

This is conservatively correct, but has the effect that LSR will strip
nneg flags on zext instructions involved in trip counts in loop
preheaders. To avoid this, this patch adjusts the expanded to reinfer
the flags on the CSE candidate if legal for all possible users.

This should fix the regression reported in
https://github.com/llvm/llvm-project/issues/71200.

This should arguably be done inside canReuseInstruction instead, but
doing it outside is more conservative compile time wise. Both
canReuseInstruction and isGuaranteedNotToBePoison walk operand lists, so
right now we are performing work which is roughly O(N^2) in the size of
the operand graph. We should fix that before making the per operand step
more expensive. My tenative plan is to land this, and then rework the
code to sink the logic into more core interfaces.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
LSR uses SCEVExpander to generate induction formulas. The expander
internally tries to reuse existing IR expressions. To do that, it needs
to strip any poison generating flags (nsw, nuw, exact, nneg, etc..)
which may not be valid for the newly added users.

This is conservatively correct, but has the effect that LSR will strip
nneg flags on zext instructions involved in trip counts in loop
preheaders. To avoid this, this patch adjusts the expanded to reinfer
the flags on the CSE candidate if legal for all possible users.

This should fix the regression reported in
https://github.com/llvm/llvm-project/issues/71200.

This should arguably be done inside canReuseInstruction instead, but
doing it outside is more conservative compile time wise. Both
canReuseInstruction and isGuaranteedNotToBePoison walk operand lists, so
right now we are performing work which is roughly O(N^2) in the size of
the operand graph. We should fix that before making the per operand step
more expensive. My tenative plan is to land this, and then rework the
code to sink the logic into more core interfaces.</pre>
</div>
</content>
</entry>
<entry>
<title>[GuardUtils] Revert llvm::isWidenableBranch change (#66411)</title>
<updated>2023-09-20T09:27:54+00:00</updated>
<author>
<name>Aleksandr Popov</name>
<email>42888396+aleks-tmb@users.noreply.github.com</email>
</author>
<published>2023-09-20T09:27:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=e9dfe083f0fc37ee03506f3b8b8d68750927f613'/>
<id>e9dfe083f0fc37ee03506f3b8b8d68750927f613</id>
<content type='text'>
In the d6e7c162e1df3736d8e2b3610a831b7cfa5be99b was introduced util to
to extract widenable conditions from branch. That util was applied in
the llvm::isWidenableBranch to check if branch is widenable. So we
consider branch is widenable if it has widenable condition anywhere in
the condition tree. But that will be true when we finish GuardWidening
reworking from branch widening to widenable conditions widening.
For now we still need to check that widenable branch is in the form of:
`br(widenable_condition &amp; (...))`,
because that form is assumed by LoopPredication and GuardWidening
algorithms.

Fixes: https://github.com/llvm/llvm-project/issues/66418

Co-authored-by: Aleksander Popov &lt;apopov@azul.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In the d6e7c162e1df3736d8e2b3610a831b7cfa5be99b was introduced util to
to extract widenable conditions from branch. That util was applied in
the llvm::isWidenableBranch to check if branch is widenable. So we
consider branch is widenable if it has widenable condition anywhere in
the condition tree. But that will be true when we finish GuardWidening
reworking from branch widening to widenable conditions widening.
For now we still need to check that widenable branch is in the form of:
`br(widenable_condition &amp; (...))`,
because that form is assumed by LoopPredication and GuardWidening
algorithms.

Fixes: https://github.com/llvm/llvm-project/issues/66418

Co-authored-by: Aleksander Popov &lt;apopov@azul.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>[LoopPredication] Fix division by zero in case of zero branch weights (#66506)</title>
<updated>2023-09-19T01:38:29+00:00</updated>
<author>
<name>Danila Malyutin</name>
<email>danilaml@users.noreply.github.com</email>
</author>
<published>2023-09-19T01:38:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=a668c0f687f9029c3171c757e1fa5df891eb7558'/>
<id>a668c0f687f9029c3171c757e1fa5df891eb7558</id>
<content type='text'>
Treat the case where all branch weights are zero as if there was no
profile.
Fixes #66382</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Treat the case where all branch weights are zero as if there was no
profile.
Fixes #66382</pre>
</div>
</content>
</entry>
<entry>
<title>[NFC] Add test for #66382</title>
<updated>2023-09-14T18:10:00+00:00</updated>
<author>
<name>Danila Malyutin</name>
<email>dmalyutin@azul.com</email>
</author>
<published>2023-09-14T18:10:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=e80a8b4ab61ef6aba119adf5f64a4644b7e0a44b'/>
<id>e80a8b4ab61ef6aba119adf5f64a4644b7e0a44b</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[LoopPredication] Rework assumes of widened conditions</title>
<updated>2023-08-18T12:35:46+00:00</updated>
<author>
<name>Aleksandr Popov</name>
<email>a.popov.tmb@gmail.com</email>
</author>
<published>2023-08-18T12:35:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=1b87882228b0371212753781a363d4addd1bafa7'/>
<id>1b87882228b0371212753781a363d4addd1bafa7</id>
<content type='text'>
Currently after widening br(WC &amp;&amp; (c1 &amp;&amp; c2)) we insert assume of
(c1 &amp;&amp; c2) which is joined to WC by And operation.
But we are going to support more flexible form of widenable branches
where WC could be placed arbitrary in the expression tree, e.g:
br(c1 &amp;&amp; (c2 &amp;&amp; WC)).
In that case we won't have (c1 &amp;&amp; c2) in the IR. So we need to add
explicit (c1 &amp;&amp; c2) and then create an assumption of it.

Reviewed By: anna

Differential Revision: https://reviews.llvm.org/D157502
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently after widening br(WC &amp;&amp; (c1 &amp;&amp; c2)) we insert assume of
(c1 &amp;&amp; c2) which is joined to WC by And operation.
But we are going to support more flexible form of widenable branches
where WC could be placed arbitrary in the expression tree, e.g:
br(c1 &amp;&amp; (c2 &amp;&amp; WC)).
In that case we won't have (c1 &amp;&amp; c2) in the IR. So we need to add
explicit (c1 &amp;&amp; c2) and then create an assumption of it.

Reviewed By: anna

Differential Revision: https://reviews.llvm.org/D157502
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "[NFC][LoopPredication] Add parsed checks logging"</title>
<updated>2023-08-10T10:55:55+00:00</updated>
<author>
<name>Aleksandr Popov</name>
<email>a.popov.tmb@gmail.com</email>
</author>
<published>2023-08-10T10:55:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=f3016c380bfcf9ab07c3503e43b8015b3097ef80'/>
<id>f3016c380bfcf9ab07c3503e43b8015b3097ef80</id>
<content type='text'>
This reverts commit aa603c41caab63e246f4a4258c8b96e6ea06fdc9.

Revert due to LLVM Buildbot failure
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit aa603c41caab63e246f4a4258c8b96e6ea06fdc9.

Revert due to LLVM Buildbot failure
</pre>
</div>
</content>
</entry>
</feed>
