nak: Run simple liveness data-flow bottom-up

Rookie mistake... The liveness algorithm propagates information from
later blocks to earlier blocks so if you run bottom-up it's exactly two
passes when there aren't loops.  If you run top-down, it's quadratic in
the number of blocks.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
This commit is contained in:
Faith Ekstrand 2023-09-27 10:40:52 -05:00 committed by Marge Bot
parent 046a2d5004
commit 19e0c52837

View file

@ -314,7 +314,7 @@ impl SimpleLiveness {
let mut to_do = true;
while to_do {
to_do = false;
for (b_idx, bl) in l.blocks.iter_mut().enumerate() {
for (b_idx, bl) in l.blocks.iter_mut().enumerate().rev() {
/* Compute live-out */
for sb_idx in func.blocks.succ_indices(b_idx) {
to_do |= bl.live_out.union_with(&live_in[*sb_idx]);