<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.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>[InstCombine] Optimize sub(sext(add(x,y)),sext(add(x,z))). (#144174)</title>
<updated>2025-06-19T17:13:58+00:00</updated>
<author>
<name>Slava Zakharin</name>
<email>szakharin@nvidia.com</email>
</author>
<published>2025-06-19T17:13:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=c0c71463f6bca05eb4540b68cdcbd17c916562c9'/>
<id>c0c71463f6bca05eb4540b68cdcbd17c916562c9</id>
<content type='text'>
This pattern can be often met in Flang generated LLVM IR,
for example, for the counts of the loops generated for array
expressions like: `a(x:x+y)` or `a(x+z:x+z)` or their variations.

In order to compute the loop count, Flang needs to subtract
the lower bound of the array slice from the upper bound
of the array slice. To avoid the sign wraps, it sign extends
the original values (that may be of any user data type)
to `i64`.

This peephole is really helpful in CPU2017/548.exchange2,
where we have multiple following statements like this:
```
block(row+1:row+2, 7:9, i7) = block(row+1:row+2, 7:9, i7) - 10
```

While this is just a 2x3 iterations loop nest, LLVM cannot
figure it out, ending up vectorizing the inner loop really
hard (with a vector epilog and scalar remainder). This, in turn,
causes problems for LSR that ends up creating too many loop-carried
values in the loop containing the above statement, which are then
causing too many spills/reloads.

Alive2: https://alive2.llvm.org/ce/z/gLgfYX

Related to #143219.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This pattern can be often met in Flang generated LLVM IR,
for example, for the counts of the loops generated for array
expressions like: `a(x:x+y)` or `a(x+z:x+z)` or their variations.

In order to compute the loop count, Flang needs to subtract
the lower bound of the array slice from the upper bound
of the array slice. To avoid the sign wraps, it sign extends
the original values (that may be of any user data type)
to `i64`.

This peephole is really helpful in CPU2017/548.exchange2,
where we have multiple following statements like this:
```
block(row+1:row+2, 7:9, i7) = block(row+1:row+2, 7:9, i7) - 10
```

While this is just a 2x3 iterations loop nest, LLVM cannot
figure it out, ending up vectorizing the inner loop really
hard (with a vector epilog and scalar remainder). This, in turn,
causes problems for LSR that ends up creating too many loop-carried
values in the loop containing the above statement, which are then
causing too many spills/reloads.

Alive2: https://alive2.llvm.org/ce/z/gLgfYX

Related to #143219.</pre>
</div>
</content>
</entry>
<entry>
<title>[InstCombine] Fold `tan(x) * cos(x) =&gt; sin(x)` (#136319)</title>
<updated>2025-06-18T15:12:31+00:00</updated>
<author>
<name>amordo</name>
<email>iammorjj@gmail.com</email>
</author>
<published>2025-06-18T15:12:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=e4c3b037bc7f5d9a8089de4c509d3e6034735891'/>
<id>e4c3b037bc7f5d9a8089de4c509d3e6034735891</id>
<content type='text'>
This patch enables folding `tan(x) * cos(x) -&gt; sin(x)` under the `contract` flag.

Fixes https://github.com/llvm/llvm-project/issues/34950.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch enables folding `tan(x) * cos(x) -&gt; sin(x)` under the `contract` flag.

Fixes https://github.com/llvm/llvm-project/issues/34950.
</pre>
</div>
</content>
</entry>
<entry>
<title>[ValueTracking] Make Depth last default arg (NFC) (#142384)</title>
<updated>2025-06-03T16:12:24+00:00</updated>
<author>
<name>Ramkumar Ramachandra</name>
<email>ramkumar.ramachandra@codasip.com</email>
</author>
<published>2025-06-03T16:12:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=b40e4ceaa61c5f14ca261e2952e7f85a066403e2'/>
<id>b40e4ceaa61c5f14ca261e2952e7f85a066403e2</id>
<content type='text'>
Having a finite Depth (or recursion limit) for computeKnownBits is very
limiting, but is currently a load-bearing necessity, as all KnownBits
are recomputed on each call and there is no caching. As a prerequisite
for an effort to remove the recursion limit altogether, either using a
clever caching technique, or writing a easily-invalidable KnownBits
analysis, make the Depth argument in APIs in ValueTracking uniformly the
last argument with a default value. This would aid in removing the
argument when the time comes, as many callers that currently pass 0
explicitly are now updated to omit the argument altogether.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Having a finite Depth (or recursion limit) for computeKnownBits is very
limiting, but is currently a load-bearing necessity, as all KnownBits
are recomputed on each call and there is no caching. As a prerequisite
for an effort to remove the recursion limit altogether, either using a
clever caching technique, or writing a easily-invalidable KnownBits
analysis, make the Depth argument in APIs in ValueTracking uniformly the
last argument with a default value. This would aid in removing the
argument when the time comes, as many callers that currently pass 0
explicitly are now updated to omit the argument altogether.</pre>
</div>
</content>
</entry>
<entry>
<title>[InstCombine] Fold mul (shr exact (X, N)), 2^N + 1 -&gt; add (X , shr exact (X, N)) (#112407)</title>
<updated>2025-02-13T06:25:09+00:00</updated>
<author>
<name>AZero13</name>
<email>gfunni234@gmail.com</email>
</author>
<published>2025-02-13T06:25:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=ffd263306194f3d8246e2f25184a44a7f78185be'/>
<id>ffd263306194f3d8246e2f25184a44a7f78185be</id>
<content type='text'>
Alive2 Proofs:
https://alive2.llvm.org/ce/z/aJnxyp
https://alive2.llvm.org/ce/z/dyeGEv</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Alive2 Proofs:
https://alive2.llvm.org/ce/z/aJnxyp
https://alive2.llvm.org/ce/z/dyeGEv</pre>
</div>
</content>
</entry>
<entry>
<title>[NFC][DebugInfo] Use iterators for insertion at some final callsites</title>
<updated>2025-01-28T11:37:11+00:00</updated>
<author>
<name>Jeremy Morse</name>
<email>jeremy.morse@sony.com</email>
</author>
<published>2025-01-28T09:51:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=304a99091c84f303ff5037dc6bf5455e4cfde7a1'/>
<id>304a99091c84f303ff5037dc6bf5455e4cfde7a1</id>
<content type='text'>
These are the callsites that have materialised in the last three weeks
since I last built with deprecation warnings.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
These are the callsites that have materialised in the last three weeks
since I last built with deprecation warnings.
</pre>
</div>
</content>
</entry>
<entry>
<title>[InstCombine] Fixup commit 7253c6f (#123315)</title>
<updated>2025-01-17T10:14:04+00:00</updated>
<author>
<name>Sushant Gokhale</name>
<email>sgokhale@nvidia.com</email>
</author>
<published>2025-01-17T10:14:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=e79bb8731ae9089f0635e5634883267a091e318d'/>
<id>e79bb8731ae9089f0635e5634883267a091e318d</id>
<content type='text'>
This should fix the assert failure we were getting for the darwin OS.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This should fix the assert failure we were getting for the darwin OS.</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "Revert "[InstCombine] Transform high latency, dependent FSQRT/FDIV into FMUL"" (#123313)</title>
<updated>2025-01-17T10:05:05+00:00</updated>
<author>
<name>Sushant Gokhale</name>
<email>sgokhale@nvidia.com</email>
</author>
<published>2025-01-17T10:05:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=3b3590aa59f6ba35c746c01c0692621494b62cab'/>
<id>3b3590aa59f6ba35c746c01c0692621494b62cab</id>
<content type='text'>
Reverts llvm/llvm-project#123289</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reverts llvm/llvm-project#123289</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "[InstCombine] Transform high latency, dependent FSQRT/FDIV into FMUL" (#123289)</title>
<updated>2025-01-17T06:50:20+00:00</updated>
<author>
<name>Sushant Gokhale</name>
<email>sgokhale@nvidia.com</email>
</author>
<published>2025-01-17T06:50:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=606d0a7cdc0c551df754eb4494a2c16861b6a9b9'/>
<id>606d0a7cdc0c551df754eb4494a2c16861b6a9b9</id>
<content type='text'>
Reverts llvm/llvm-project#87474</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reverts llvm/llvm-project#87474</pre>
</div>
</content>
</entry>
<entry>
<title>[InstCombine] Transform high latency, dependent FSQRT/FDIV into FMUL (#87474)</title>
<updated>2025-01-17T05:09:15+00:00</updated>
<author>
<name>Sushant Gokhale</name>
<email>sgokhale@nvidia.com</email>
</author>
<published>2025-01-17T05:09:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=7253c6fde498c4c9470b681df47d46e6930d6a02'/>
<id>7253c6fde498c4c9470b681df47d46e6930d6a02</id>
<content type='text'>
The proposed patch, in general, tries to transform the below code
sequence:
x = 1.0 / sqrt (a);
r1 = x * x;  // same as 1.0 / a
r2 = a / sqrt(a); // same as sqrt (a)

TO

(If x, r1 and r2 are all used further in the code) 
r1 = 1.0 / a
r2 = sqrt (a)
x = r1 * r2

The transform tries to make high latency sqrt and div operations
independent and also saves on one multiplication.

The patch was tested with SPEC17 suite with cpu=neoverse-v2. The
performance uplift achieved was:
544.nab_r   ~4%

No other regressions were observed. Also, no compile time differences
were observed with the patch.

Closes #54652</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The proposed patch, in general, tries to transform the below code
sequence:
x = 1.0 / sqrt (a);
r1 = x * x;  // same as 1.0 / a
r2 = a / sqrt(a); // same as sqrt (a)

TO

(If x, r1 and r2 are all used further in the code) 
r1 = 1.0 / a
r2 = sqrt (a)
x = r1 * r2

The transform tries to make high latency sqrt and div operations
independent and also saves on one multiplication.

The patch was tested with SPEC17 suite with cpu=neoverse-v2. The
performance uplift achieved was:
544.nab_r   ~4%

No other regressions were observed. Also, no compile time differences
were observed with the patch.

Closes #54652</pre>
</div>
</content>
</entry>
<entry>
<title>[InstCombine] Fold `X udiv Y` to `X lshr cttz(Y)` if Y is a power of 2 (#121386)</title>
<updated>2025-01-11T05:56:13+00:00</updated>
<author>
<name>Veera</name>
<email>32646674+veera-sivarajan@users.noreply.github.com</email>
</author>
<published>2025-01-11T05:56:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=2d5f07c82836bde6f5ae16518931a78783a22ec8'/>
<id>2d5f07c82836bde6f5ae16518931a78783a22ec8</id>
<content type='text'>
Fixes #115767

This PR folds `X udiv Y` to `X lshr cttz(Y)` if Y is a power of two
since bitwise operations are faster than division.

Proof: https://alive2.llvm.org/ce/z/qHmLta</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes #115767

This PR folds `X udiv Y` to `X lshr cttz(Y)` if Y is a power of two
since bitwise operations are faster than division.

Proof: https://alive2.llvm.org/ce/z/qHmLta</pre>
</div>
</content>
</entry>
</feed>
