<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/llvm/lib/Target/DirectX/DXILLegalizePass.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>[DirectX] add maybe_unused to IsVolatile in legalizeMemCpy. (#143040)</title>
<updated>2025-06-06T00:41:03+00:00</updated>
<author>
<name>Farzon Lotfi</name>
<email>farzonlotfi@microsoft.com</email>
</author>
<published>2025-06-06T00:41:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=c21218312ee241de020e440330bb0ec7e557031b'/>
<id>c21218312ee241de020e440330bb0ec7e557031b</id>
<content type='text'>
fixes a warning when building release.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
fixes a warning when building release.</pre>
</div>
</content>
</entry>
<entry>
<title>[DirectX] replace byte splitting via vector bitcast with scalar (#140167)</title>
<updated>2025-06-05T01:28:43+00:00</updated>
<author>
<name>Farzon Lotfi</name>
<email>farzonlotfi@microsoft.com</email>
</author>
<published>2025-06-05T01:28:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=c1e0faecfc47cc078014f4d64214f90c492b7db8'/>
<id>c1e0faecfc47cc078014f4d64214f90c492b7db8</id>
<content type='text'>
instructions
- instead of bitcasting and extract element lets use trunc or trunc and
logical shift right to split.
- fixes #139020</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
instructions
- instead of bitcasting and extract element lets use trunc or trunc and
logical shift right to split.
- fixes #139020</pre>
</div>
</content>
</entry>
<entry>
<title>[DirectX] add GEP i8 legalization (#142475)</title>
<updated>2025-06-04T19:31:15+00:00</updated>
<author>
<name>Farzon Lotfi</name>
<email>farzonlotfi@microsoft.com</email>
</author>
<published>2025-06-04T19:31:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=5411ebdebc445b32982b75a94d347b5fcdd8ece9'/>
<id>5411ebdebc445b32982b75a94d347b5fcdd8ece9</id>
<content type='text'>
fixes #140415

The i8 legalization code in DXILLegalizePass's `fixI8UseChain` needs to
be updated to check for i8 geps.
It seems like there are i8 GEPs being left around after we remove all
the other i8 instructions and this is causing problem on validation.

Since this is cleaning up a missed GEP The approach is to assume the
getPointerOperand is to an alloca we further will check if this is an
array alloca then do some byte offset arithmetic to figure out the
memory index to use. Finally we will emit the new gep and cleanup the
old one.

Finally needed to update upcastI8AllocasAndUses to account for loads off
of GEPs instead of just loads from the alloca.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
fixes #140415

The i8 legalization code in DXILLegalizePass's `fixI8UseChain` needs to
be updated to check for i8 geps.
It seems like there are i8 GEPs being left around after we remove all
the other i8 instructions and this is causing problem on validation.

Since this is cleaning up a missed GEP The approach is to assume the
getPointerOperand is to an alloca we further will check if this is an
array alloca then do some byte offset arithmetic to figure out the
memory index to use. Finally we will emit the new gep and cleanup the
old one.

Finally needed to update upcastI8AllocasAndUses to account for loads off
of GEPs instead of just loads from the alloca.</pre>
</div>
</content>
</entry>
<entry>
<title>[HLSL] Move FNeg legalization to the DXILLegalization pass (#140942)</title>
<updated>2025-05-22T16:43:00+00:00</updated>
<author>
<name>Sumit Agarwal</name>
<email>sumitagarwal@microsoft.com</email>
</author>
<published>2025-05-22T16:43:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=b9361126488ff6749e23a997640f839dd20ac331'/>
<id>b9361126488ff6749e23a997640f839dd20ac331</id>
<content type='text'>
Fixes #137685</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes #137685</pre>
</div>
</content>
</entry>
<entry>
<title>[DirectX] Legalize memcpy (#139173)</title>
<updated>2025-05-19T16:34:58+00:00</updated>
<author>
<name>Deric C.</name>
<email>cheung.deric@gmail.com</email>
</author>
<published>2025-05-19T16:34:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=12fb0d451bbdd1d1e8035197e4f5e47e8afa6141'/>
<id>12fb0d451bbdd1d1e8035197e4f5e47e8afa6141</id>
<content type='text'>
Fixes #137188 

This PR legalizes memcpy for DXIL in cases where:
- the src and dst arguments are from Alloca or a GlobalVariable,
- the src and dst are pointers to an ArrayType,
- the array element types of src and dst must be equivalent, and
- the len param is a ConstantInt

These assumptions simplify the legalization and, with the addition of
#138991, covers the currently-known cases of memcpy that appear when
compiling DML shaders.

This PR may be unnecessary if #138788 determines that memset and memcpy
can be eliminated entirely.

---------

Co-authored-by: Finn Plummer &lt;canadienfinn@gmail.com&gt;
Co-authored-by: Greg Roth &lt;grroth@microsoft.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes #137188 

This PR legalizes memcpy for DXIL in cases where:
- the src and dst arguments are from Alloca or a GlobalVariable,
- the src and dst are pointers to an ArrayType,
- the array element types of src and dst must be equivalent, and
- the len param is a ConstantInt

These assumptions simplify the legalization and, with the addition of
#138991, covers the currently-known cases of memcpy that appear when
compiling DML shaders.

This PR may be unnecessary if #138788 determines that memset and memcpy
can be eliminated entirely.

---------

Co-authored-by: Finn Plummer &lt;canadienfinn@gmail.com&gt;
Co-authored-by: Greg Roth &lt;grroth@microsoft.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>[DirectX] legalize memset (#136244)</title>
<updated>2025-04-30T21:09:28+00:00</updated>
<author>
<name>Farzon Lotfi</name>
<email>farzonlotfi@microsoft.com</email>
</author>
<published>2025-04-30T21:09:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=02e316cf8c9c73aad580e8c0d1b3b691567601ca'/>
<id>02e316cf8c9c73aad580e8c0d1b3b691567601ca</id>
<content type='text'>
fixes #136243

This change converts memset into a series of geps and stores It is
intentionally limited to memsets of fixed size It also converts the byte
stores to type stores.
DXIL does not support i8 plus this reduces the total number of gep and
store instructions.
This change also moves DXILFinalizeLinkage to run after Legalization to
clean up any dead intrinsic definitions.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
fixes #136243

This change converts memset into a series of geps and stores It is
intentionally limited to memsets of fixed size It also converts the byte
stores to type stores.
DXIL does not support i8 plus this reduces the total number of gep and
store instructions.
This change also moves DXILFinalizeLinkage to run after Legalization to
clean up any dead intrinsic definitions.</pre>
</div>
</content>
</entry>
<entry>
<title>[DirectX] Legalize i8 allocas (#137399)</title>
<updated>2025-04-29T20:07:44+00:00</updated>
<author>
<name>Farzon Lotfi</name>
<email>farzonlotfi@microsoft.com</email>
</author>
<published>2025-04-29T20:07:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=d3d35adcd32c91e9076be6bb242dd6c82c490c4b'/>
<id>d3d35adcd32c91e9076be6bb242dd6c82c490c4b</id>
<content type='text'>
fixes #137202

investingating i8 allocas I came to find some missing instructions from
out i8 legalization around load, store, and select.
Added those three.

To do i8 allocas right though we needed to walk the uses and find the
casts.

After finding the casts I chose to pick the smallest cast as the cast to
transform to. That would then let me preserve the larger casts that come
later</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
fixes #137202

investingating i8 allocas I came to find some missing instructions from
out i8 legalization around load, store, and select.
Added those three.

To do i8 allocas right though we needed to walk the uses and find the
casts.

After finding the casts I chose to pick the smallest cast as the cast to
transform to. That would then let me preserve the larger casts that come
later</pre>
</div>
</content>
</entry>
<entry>
<title>[DirectX] Legalize Freeze instruction (#136043)</title>
<updated>2025-04-17T16:02:05+00:00</updated>
<author>
<name>Farzon Lotfi</name>
<email>farzonlotfi@microsoft.com</email>
</author>
<published>2025-04-17T16:02:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=168092e2ba432c0995806470790fa5aef3d7315b'/>
<id>168092e2ba432c0995806470790fa5aef3d7315b</id>
<content type='text'>
fixes #135719

LLVM 3.7 did not have a freeze instruction
Further this instruction is really only used as syntactic sugar
in LLVM's optimizer passes to not aggressively optimize things that
could be undef or poison ie x*2 to x+x.
Most backends treat it as a no-op so we will do the same
by removing it and replacing its uses with its input.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
fixes #135719

LLVM 3.7 did not have a freeze instruction
Further this instruction is really only used as syntactic sugar
in LLVM's optimizer passes to not aggressively optimize things that
could be undef or poison ie x*2 to x+x.
Most backends treat it as a no-op so we will do the same
by removing it and replacing its uses with its input.</pre>
</div>
</content>
</entry>
<entry>
<title>[DirectX] Address PR comments to #131221 (#131706)</title>
<updated>2025-03-21T02:35:21+00:00</updated>
<author>
<name>Farzon Lotfi</name>
<email>farzonlotfi@microsoft.com</email>
</author>
<published>2025-03-21T02:35:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=8d825cb4e2d28161ad498d6651ce4413f7d96125'/>
<id>8d825cb4e2d28161ad498d6651ce4413f7d96125</id>
<content type='text'>
- [x] [Don't include static inside anonymous
namespace](https://github.com/llvm/llvm-project/pull/131221#discussion_r1999924822)
- [x] [Use
DenseMap](https://github.com/llvm/llvm-project/pull/131221#discussion_r1999922148)
- [x] [remove
{}](https://github.com/llvm/llvm-project/pull/131221#discussion_r1999921283)
- [x] [remove std::stack with llvm::reverse of
SmallVector](https://github.com/llvm/llvm-project/pull/131221#discussion_r1999946122)
- [x] [replace std::vector with
llvm::SmallVector](https://github.com/llvm/llvm-project/pull/131221#discussion_r1999915308)
- [x] [Remove legalize comment
block](https://github.com/llvm/llvm-project/pull/131221#discussion_r1999903366)
and [double comment
block](https://github.com/llvm/llvm-project/pull/131221#discussion_r1999903747)
- [x] [Refactor fixI8TruncUseChain to remove
nesting](https://github.com/llvm/llvm-project/pull/131221#discussion_r2004157432)
- [x] [add asserts on
assumptions](https://github.com/llvm/llvm-project/pull/131221#discussion_r2004170759)</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
- [x] [Don't include static inside anonymous
namespace](https://github.com/llvm/llvm-project/pull/131221#discussion_r1999924822)
- [x] [Use
DenseMap](https://github.com/llvm/llvm-project/pull/131221#discussion_r1999922148)
- [x] [remove
{}](https://github.com/llvm/llvm-project/pull/131221#discussion_r1999921283)
- [x] [remove std::stack with llvm::reverse of
SmallVector](https://github.com/llvm/llvm-project/pull/131221#discussion_r1999946122)
- [x] [replace std::vector with
llvm::SmallVector](https://github.com/llvm/llvm-project/pull/131221#discussion_r1999915308)
- [x] [Remove legalize comment
block](https://github.com/llvm/llvm-project/pull/131221#discussion_r1999903366)
and [double comment
block](https://github.com/llvm/llvm-project/pull/131221#discussion_r1999903747)
- [x] [Refactor fixI8TruncUseChain to remove
nesting](https://github.com/llvm/llvm-project/pull/131221#discussion_r2004157432)
- [x] [add asserts on
assumptions](https://github.com/llvm/llvm-project/pull/131221#discussion_r2004170759)</pre>
</div>
</content>
</entry>
<entry>
<title>[DirectX]  Start the creation of a DXIL Instruction legalizer (#131221)</title>
<updated>2025-03-18T00:33:02+00:00</updated>
<author>
<name>Farzon Lotfi</name>
<email>farzonlotfi@microsoft.com</email>
</author>
<published>2025-03-18T00:33:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=a2fbc9a8e3d3822cea6f14299285ff0a440d1bf3'/>
<id>a2fbc9a8e3d3822cea6f14299285ff0a440d1bf3</id>
<content type='text'>
- Legalize i8 truncation back to original types
-  remove sext and truncs
- Legalize i64 indicies for insert\extract elements to i32 indicies
- fixes https://github.com/llvm/llvm-project/issues/126323
- fixes https://github.com/llvm/llvm-project/issues/129757</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
- Legalize i8 truncation back to original types
-  remove sext and truncs
- Legalize i64 indicies for insert\extract elements to i32 indicies
- fixes https://github.com/llvm/llvm-project/issues/126323
- fixes https://github.com/llvm/llvm-project/issues/129757</pre>
</div>
</content>
</entry>
</feed>
