Hans-Kristian Arntzen
6b71ee8cf6
Deal with collapsing of fake_succs.
2025-03-11 16:32:55 +01:00
Hans-Kristian Arntzen
2e200899b9
Avoid tripping asserts during complex rewrites.
2025-02-11 10:28:39 +01:00
Hans-Kristian Arntzen
07c97d30b8
Fix silly copy paste error in backtrace code.
2024-11-26 11:24:20 +01:00
Hans-Kristian Arntzen
2d5049b9d2
Add helper to backtrace to node with blocker nodes.
2024-11-25 12:56:40 +01:00
Hans-Kristian Arntzen
fdbcdb0b05
Insert block early into set when traversing.
2023-12-04 11:43:32 +01:00
Friedrich Vock
4fd850a332
Allow loops in dominates_all_reachable_exits
2023-12-02 02:47:16 +01:00
Hans-Kristian Arntzen
e1b40e1a88
Ensure that hoisted switch branches can merge to proper target.
...
The switch block itself may be on a breaking path.
2023-10-27 13:42:47 +02:00
Hans-Kristian Arntzen
18014770a3
Don't add fake_succ if we already have a normal succ.
...
Fixes benign assert in our test suite.
2023-06-28 17:48:02 +02:00
Hans-Kristian Arntzen
60f311803c
Consider duplicate branches when eliminating degenerates.
...
Refactor with intermediate block to conditionally consider it if needed.
2023-05-12 14:54:17 +02:00
Hans-Kristian Arntzen
9cdf10e5ac
Use a less trivial check for backwards visibility.
2023-05-10 14:24:47 +02:00
Hans-Kristian Arntzen
2cde1c00e9
Fix backwards traversal of nested loops that are not reachable.
...
Need to resolve outside-in, and also consider there might be ladder
blocks inbetween.
2023-03-24 14:21:28 +01:00
Hans-Kristian Arntzen
8f29981a08
Rewrite multiple back edges if needed.
2023-03-24 13:36:24 +01:00
Hans-Kristian Arntzen
63621301a8
Fixup broken loop breaks post structurization.
...
With block-like loop constructs, we risk
generating invalid code, so need to carefully fix it up iteratively if
we have to.
2022-07-15 18:12:44 +02:00
Hans-Kristian Arntzen
873d0a2b58
Refactor out traverse_and_rewrite to structurizer.
...
We'll need to query reachability to do it properly.
2022-07-15 14:41:37 +02:00
Hans-Kristian Arntzen
9ababf2e2e
Relicense to MIT.
2022-05-18 19:27:56 +02:00
Hans-Kristian Arntzen
1b66fd7534
Move out loop header checks to structurizer.
...
Need to check reachability from back-edge when accepting a header.
2022-04-28 12:49:34 +02:00
Hans-Kristian Arntzen
d99c572298
Rewrite check for post_dominates_any_work() to work with ladder merges.
...
Need to do a complete backtrace, not just single pred analysis.
2022-04-08 12:45:17 +02:00
Hans-Kristian Arntzen
28930a3bba
Consider impossible fallthrough scenarios with default blocks as well.
...
We only checked cases, but default block is also block like any other.
Refactor default blocks to be just a normal case label.
2022-04-07 17:13:16 +02:00
Hans-Kristian Arntzen
86db84510b
Skip redundant rewrite traversals.
2022-04-07 12:02:16 +02:00
Hans-Kristian Arntzen
dfa103fe81
Do not explicitly check if block is load bearing.
...
This is handled by the appropriate functions implicitly.
We don't want to consider load bearing for loop break blocks, since that
check is much stronger than for selection constructs.
2022-04-04 16:27:17 +02:00
Hans-Kristian Arntzen
a93632b18a
Add extended and stronger check for escape analysis.
2022-04-04 15:00:54 +02:00
Hans-Kristian Arntzen
6e2653424b
Don't create duplicate edges when rewriting branches.
...
Detect this scenario and create intermediate blocks instead.
2021-08-24 12:33:07 +02:00
Hans-Kristian Arntzen
e03c216348
Rewrite fake succ blocks when retargeting branches.
2021-05-12 13:33:18 +02:00
Hans-Kristian Arntzen
55598d6a1f
Be a bit more robust against weird cases in domination checks.
2021-05-12 12:52:35 +02:00
Hans-Kristian Arntzen
0d6d34e50d
Handle tie breaks in common dominator analysis.
...
When we introduce interim ladder blocks, we might not be able to
recompute the CFG until an entire pass has run, and in the meantime, we
need to take special care when post-visit order indices match.
2021-05-12 12:51:06 +02:00
Hans-Kristian Arntzen
aa054e8e0f
Make sure ladders merge to a nesting scope.
2021-04-26 11:55:48 +02:00
Hans-Kristian Arntzen
41d9da949a
Fix minor nits.
2021-04-23 14:04:34 +02:00
David McCloskey
624a7dd659
Shader seemingly hits infinite loop in graph traversal but instead just takes incredibly long to complete.
2021-04-22 15:46:08 -07:00
Hans-Kristian Arntzen
72211e36a2
Re-seat header blocks when rewriting header -> merge block.
...
Otherwise, we might end up trying to create ladder blocks at merge blocks which are no longer correct.
2021-03-23 18:30:48 +01:00
Hans-Kristian Arntzen
1829b70f1e
Do not leave dangling preds when recomputing dominance.
2021-02-12 12:27:18 +01:00
Hans-Kristian Arntzen
c876f23b84
Add traversal cache to CFGNode::can_backtrace_to.
2021-02-03 11:12:21 +01:00
Hans-Kristian Arntzen
2788c95c0b
Make sure we set up dominators when using temporary ladder blocks.
...
Fixes a crash with some particular shaders.
2021-02-01 13:23:38 +01:00
Hans-Kristian Arntzen
96b15a1a52
Update copyright headers to 2021.
2021-01-15 13:41:54 +01:00
Hans-Kristian Arntzen
925b7d653d
Promote direct exits to dominated merges if necessary.
2020-11-13 17:12:20 +01:00
Hans-Kristian Arntzen
aa96e6b590
Ensure a reducible flipped CFG.
...
Makes post-traversal far more robust.
2020-07-31 17:00:30 +02:00
Hans-Kristian Arntzen
7050e490ed
Avoid embarassing exponential explosion in traverse_dominated_blocks.
2020-07-31 14:52:39 +02:00
Hans-Kristian Arntzen
b53e73d8c2
Recompute immediate post dominator for continue block right away.
...
It might be nullptr in some cases.
2020-07-31 13:49:37 +02:00
Hans-Kristian Arntzen
8e01e9f8bc
Move out exists_path_in_cfg_without_intermediate_node.
2020-07-24 16:11:27 +02:00
Hans-Kristian Arntzen
f023958920
Fix some issues with post dominance of unreachable loops.
2020-07-24 16:11:27 +02:00
Hans-Kristian Arntzen
ac529f5dff
Use the more proper algorithm to query post domination.
2020-07-24 16:11:27 +02:00
Hans-Kristian Arntzen
5b057cea1c
Build a post-dominance tree as well.
...
Evaluating post dominance is ridiculously slow without it.
2020-07-24 16:11:27 +02:00
Hans-Kristian Arntzen
0a93b05dcf
Rename visit_order to forward_visit_order.
2020-07-24 16:11:27 +02:00
Hans-Kristian Arntzen
06e1c87a60
Fix PHI fixup when incoming value is not generated in continue block.
...
Need to allow frontiers to be any pred of continue block as well.
2020-07-24 16:11:27 +02:00
Hans-Kristian Arntzen
2ff9044c84
Deal with false positive inner loop merges.
...
If the inner loop can only exit at the loop header for whatever reason,
we should treat it as a false positive, since post-dominance analysis
will surely fail.
2020-07-24 16:11:27 +02:00
Hans-Kristian Arntzen
826910da29
Need to take post-domination into account when finding outer selection.
2020-05-14 13:50:25 +02:00
Hans-Kristian Arntzen
df7e49f3fb
Update namespace to dxil_spv.
2020-01-22 15:42:45 +01:00
Hans-Kristian Arntzen
49b544657d
Comment out debug logging for now.
2020-01-22 15:22:31 +01:00
Hans-Kristian Arntzen
9e5395f625
Update copyright headers for 2020.
2020-01-13 12:23:41 +01:00
Hans-Kristian Arntzen
f19a6ea441
Retarget all immediate dominators on create_succ_helper.
...
Fix some cases with continue blocks, and deal with undefined inputs to
PHI merges.
2019-12-13 14:50:04 +01:00
Hans-Kristian Arntzen
87f54d3992
Fix PHI when block has dead preds.
2019-12-12 12:34:11 +01:00