diff options
author | Igor Wodiany <igor.wodiany@imgtec.com> | 2025-04-30 13:38:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-30 13:38:36 +0100 |
commit | 730f4a1ab3b642aa0ce1c88a9a2f80efbbb33539 (patch) | |
tree | d336446ab70eaa79362977ec02e008c390281b5c /llvm/unittests/ADT/ArrayRefTest.cpp | |
parent | 8dc89e34199b6b1d0f5ea1f9940ccc8e957eef0a (diff) | |
download | llvm-730f4a1ab3b642aa0ce1c88a9a2f80efbbb33539.zip llvm-730f4a1ab3b642aa0ce1c88a9a2f80efbbb33539.tar.gz llvm-730f4a1ab3b642aa0ce1c88a9a2f80efbbb33539.tar.bz2 |
[mlir][spirv] Split header and merge block in `mlir.selection`s (#134875)
In the example below with the current code the first selection construct
(`if`/`else` in GLSL for simplicity) share its merge block with a header
block of the second construct.
```
bool _115;
if (_107)
{
// ...
_115 = _200 < _174;
}
else
{
_115 = _107;
}
bool _123;
if (_115)
{
// ...
_123 = _213 < _174;
}
else
{
_123 = _115;
}
```
This results in a malformed nesting of `mlir.selection` instructions
where one selection ends up inside a header block of another selection
construct. For example:
```
%61 = spirv.mlir.selection -> i1 {
%80 = spirv.mlir.selection -> i1 {
spirv.BranchConditional %60, ^bb1, ^bb2(%60 : i1)
^bb1: // pred: ^bb0
// ...
spirv.Branch ^bb2(%101 : i1)
^bb2(%102: i1): // 2 preds: ^bb0, ^bb1
spirv.mlir.merge %102 : i1
}
spirv.BranchConditional %80, ^bb1, ^bb2(%80 : i1)
^bb1: // pred: ^bb0
// ...
spirv.Branch ^bb2(%90 : i1)
^bb2(%91: i1): // 2 preds: ^bb0, ^bb1
spirv.mlir.merge %91 : i1
}
```
This change ensures that the merge block of one selection is not a
header block of another, splitting blocks if necessary. The existing
block splitting mechanism is updated to handle this case.
Diffstat (limited to 'llvm/unittests/ADT/ArrayRefTest.cpp')
0 files changed, 0 insertions, 0 deletions