5 Commits

Author SHA1 Message Date
S. Bharadwaj Yadavalli
41745a2005
[NFC][DirectX] Change deprecated insertBefore(Instruction*) API (#125308)
This fixes build errors due to deprecation of this API in commit
79499f010d2bfe809187a9a5f042d4e4ee1f1bcc

All tests in llvm/test/CodeGen/DirectX - including those added in commit
5ac624c8234fe0a62cbf0447dbf7035ea29d062e that added the original code
verified to pass.
2025-01-31 17:45:16 -05:00
Farzon Lotfi
6457aee5b7
[DirectX] Bug fix for Data Scalarization crash (#118426)
Two bugs here. First calling `Inst->getFunction()` has undefined
behavior if the instruction is not tracked to a function. I suspect the
`replaceAllUsesWith` was leaving the GEPs in a weird ghost parent
situation. I switched up the visitor to be able to `eraseFromParent` as
part of visiting and then everything started working.

The second bug was in `DXILFlattenArrays.cpp`. I was unaware that you
can have multidimensional arrays of `zeroinitializer`, and `undef` so
fixed up the initializer to handle these two cases.

fixes #117273
2024-12-18 16:33:49 -05:00
Justin Bogner
3eca15cbb9
[DirectX] Split resource info into type and binding info. NFC (#119773)
This splits the DXILResourceAnalysis pass into TypeAnalysis and
BindingAnalysis passes. The type analysis pass is made immutable and
populated lazily so that it can be used earlier in the pipeline without
needing to carefully maintain the invariants of the binding analysis.

Fixes #118400
2024-12-18 09:02:28 -07:00
Justin Bogner
e0b522dd94
[DirectX] Fix crash in DXILFlattenArrays for function declarations (#116690)
We were skipping intrinsics here, but really we need to skip all
function declarations - if the function doesn't have a body there's
nothing to walk.
2024-11-18 13:56:33 -08:00
Farzon Lotfi
5ac624c823
[DirectX] Flatten arrays (#114332)
-  Relevant piece is `DXILFlattenArrays.cpp`
- Loads and Store Instruction visits are just for finding
GetElementPtrConstantExpr and splitting them.
-  Allocas needed to be replaced with flattened allocas.
- Global arrays were similar to allocas. Only interesting piece here is
around initializers.
- Most of the work went into building correct GEP chains. The approach
here was a recursive strategy via `recursivelyCollectGEPs`.
- All intermediary GEPs get marked for deletion and only the leaf GEPs
get updated with the new index.

fixes [89646](https://github.com/llvm/llvm-project/issues/89646)
2024-11-13 16:36:24 -05:00