Hans-Kristian Arntzen
c26dc4b773
Actually recompute CFG before doing WAR.
2025-09-19 17:46:26 +02:00
Hans-Kristian Arntzen
c3db8244fd
Add shader quirk to rewrite some suspect looking undef phi inputs.
2025-09-18 11:22:33 +02:00
Hans-Kristian Arntzen
663d9ab7c8
Add CFG mode for pre-structurized code.
2025-08-04 12:43:28 +02:00
Hans-Kristian Arntzen
99dbc91041
Fix sink_ssa_constructs_run.
2025-08-04 12:20:58 +02:00
Hans-Kristian Arntzen
3d8f1bc394
Break ladder blocks which cause invalid merges inside a continue.
2025-07-29 12:51:32 +02:00
Hans-Kristian Arntzen
d3e39bba19
More gracefully handle double impossible fallthroughs.
...
There might be more than two natural merge candidates based on the
global ordering.
2025-05-26 12:56:54 +02:00
Hans-Kristian Arntzen
ed18ccec1f
Don't try to introduce more blocks in pass 1.
...
We won't recompute the CFG once we hit this place.
2025-05-16 14:40:07 +02:00
Hans-Kristian Arntzen
d645ce632c
Let merge block be an anchor block for interleave.
2025-05-07 12:29:59 +02:00
Hans-Kristian Arntzen
1d2cc8184f
Consider common idom when backtracing.
2025-05-07 12:29:59 +02:00
Hans-Kristian Arntzen
5244c16363
Only consider candidate blocks for serialized interleave merge.
2025-05-07 12:11:07 +02:00
Hans-Kristian Arntzen
2cb53770fe
Fix false positive assert.
2025-05-02 13:06:20 +02:00
Hans-Kristian Arntzen
7628eb2753
Flatten dubious shuffles-in-control-flow.
...
Works around bugged Dstorage 1.2.3.
2025-04-08 12:38:26 +02:00
Hans-Kristian Arntzen
0e231c6a52
Attempt to auto-insert subgroup barriers in certain cases.
...
Some shaders seem to assume that wave32 shaders run in lock-step.
This is not really the case, but we can insert subgroup barriers on
demand.
2025-03-24 15:28:10 +01:00
Hans-Kristian Arntzen
4511992cdc
Add more tie-breaks for inconclusive selection merges.
2025-03-11 13:40:50 +01:00
Hans-Kristian Arntzen
2f130a95e0
Transpose inner switch merges when feasible.
2025-02-28 14:47:16 +01:00
Hans-Kristian Arntzen
3d63aee023
Implement another pattern where deinterleave is needed.
2025-02-11 11:02:03 +01:00
Hans-Kristian Arntzen
9fbc4515ea
Look-ahead when determining if we should split blocks.
2025-02-11 10:52:06 +01:00
Hans-Kristian Arntzen
7fb4507c35
Go via OpVariable when we cannot hoist invalid phi incoming.
2025-02-11 10:41:26 +01:00
Hans-Kristian Arntzen
2e200899b9
Avoid tripping asserts during complex rewrites.
2025-02-11 10:28:39 +01:00
Hans-Kristian Arntzen
a564f0e62b
Force-split blocks if we have two switch blocks in the PDF frontier.
2025-02-11 10:28:39 +01:00
Hans-Kristian Arntzen
99a26e4708
Rematerialize SampledImage after unexpected code motion.
2025-02-05 19:27:25 +01:00
Hans-Kristian Arntzen
3cc4a2c7b5
Sink use of dynamically indexed descriptors.
...
This attempts to be a workaround for some very strange behavior in some
games that seem to assume that the compiler is sinking invalid bindless
access for them.
2025-02-05 19:27:25 +01:00
Hans-Kristian Arntzen
7d86eba5d7
Sink access chains which break value dominance.
2025-01-30 14:28:15 +01:00
Hans-Kristian Arntzen
753867b12f
Consider more situations where we want to retain break blocks.
2025-01-15 19:26:29 +01:00
Hans-Kristian Arntzen
b556da7cd4
Avoid some infinite recursion in immediate post dominator recompute.
...
When dealing with fake succs, things can get really weird and loopy.
Try to build up the immediate dominators from the ground up instead.
2025-01-15 19:26:29 +01:00
Hans-Kristian Arntzen
ccc2124aa5
Fix another broken switch cfg case.
2024-11-29 15:48:58 +01:00
Hans-Kristian Arntzen
ea66491a36
Consider that switch blocks may need to merge to unreachable.
2024-11-29 12:52:41 +01:00
Hans-Kristian Arntzen
2b7ecb3795
Be more robust against early-return switch blocks.
...
Need to trust the natural merge in this scenario.
Only seems to happen with dxbc2dxil.
2024-11-29 12:33:17 +01:00
Hans-Kristian Arntzen
86de79115b
Consider ladder break out to exit.
...
Missed a case. dxbc2dxil can hit this case, but DXC never did.
2024-11-29 11:46:48 +01:00
Hans-Kristian Arntzen
606b42b9de
If backtrace test fails, early out.
2024-11-26 11:07:48 +01:00
Hans-Kristian Arntzen
6b5e57388e
Deal better with complex interleaved merges.
...
Handle more awkward cases where there is complex control flow after the
serialized merge.
2024-11-25 12:56:56 +01:00
Hans-Kristian Arntzen
b4fac5eac7
Improve handling of infinite loops with multiple divergent breaks.
...
If the breaks enter complicated control flow, we need to try our hardest
to make sure that we collect and dispatch to avoid impossible ladder
scenarios later.
2024-09-19 11:42:16 +02:00
Hans-Kristian Arntzen
ee1d94eb88
Deal with awkward interleaved exit patterns from loops.
2024-09-04 12:08:19 +02:00
Hans-Kristian Arntzen
e6f0f5fb51
Deal with ladder rewrites when final merge target is continue block.
2024-09-03 11:48:09 +02:00
Hans-Kristian Arntzen
22b5e02fab
Improve handling of serialized merge scopes.
2024-08-29 13:15:25 +02:00
Hans-Kristian Arntzen
002e61909a
Add extra tie-break check for frontier ordering.
2024-05-27 16:46:22 +02:00
Hans-Kristian Arntzen
b55187cc61
Attempt last ditch tie-break on escape.
2024-05-27 16:26:56 +02:00
Hans-Kristian Arntzen
b0acb904d9
Only check for direct-to-continue branch if one succ.
...
Can be empty here. Fixes a stray assertion triggered by Starfield for
whatever reason.
2024-05-27 16:26:26 +02:00
Hans-Kristian Arntzen
22270b0432
Improve handling of selection merge fixup edge case.
2024-05-27 15:17:13 +02:00
Hans-Kristian Arntzen
f69962c051
Fix GCC 14 warning. Using a reference here is wrong.
...
It should not have caused crashes due to our linear allocator,
but no reason not to fix it.
2024-05-10 10:17:20 +02:00
Hans-Kristian Arntzen
5c8af91181
Allow ROV in loops as long as we can trivially hoist it.
2024-05-08 14:22:06 +02:00
Hans-Kristian Arntzen
fa36b63500
Add a way of applying driver-version specific workarounds.
...
Option should not be used except in very specific circumstances where
these workarounds are known to apply.
2024-04-30 17:06:00 +02:00
Hans-Kristian Arntzen
b5ea86bb48
Consider that ladder blocks need to keep splitting scopes in some cases.
2024-04-30 14:53:19 +02:00
Hans-Kristian Arntzen
c172d192d8
Recompute dominance frontier after plain elimination.
2024-04-18 18:01:02 +02:00
Hans-Kristian Arntzen
edf16a96d6
Clear headers even when using freeze_structured.
2024-04-18 14:22:45 +02:00
Hans-Kristian Arntzen
db0246ee3d
Consider more edge cases with continue breaks.
2024-04-17 20:42:13 +02:00
Hans-Kristian Arntzen
4f26030af6
Allow outgoing conditional branch from phi split blocks.
2024-04-17 20:42:13 +02:00
Hans-Kristian Arntzen
4321687ae7
Consider a continue stronger than a breaking construct.
...
Improve tie-break rules for selection merges.
2024-04-17 20:42:13 +02:00
Hans-Kristian Arntzen
d6cff90399
Stop scanning for continue block when seeing a new loop header.
2024-03-14 15:40:05 +01:00
Hans-Kristian Arntzen
aec320b061
Add more merge tie-breaks.
2023-12-04 14:42:25 +01:00