nak: Compute liveness in reverse block order

If we walk the blocks forwards, we end up having a minimum O(n^2)
algorithm because everything has to propagate bottom to top.  Looping
over the blocks bacwards ensures that all the liveness information is
propgated in the first pass in the absence of back edges.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
This commit is contained in:
Faith Ekstrand 2023-06-01 15:36:54 -05:00 committed by Marge Bot
parent 82f0c6cf77
commit f67fecf196

View file

@ -140,7 +140,7 @@ impl Liveness {
let mut to_do = true;
while to_do {
to_do = false;
for b in &func.blocks {
for b in func.blocks.iter().rev() {
let bl = l.blocks.get_mut(&b.id).unwrap();
/* Compute live-out */