nir/sink: Rewrite loop handling logic
authorConnor Abbott <cwabbott0@gmail.com>
Wed, 25 Sep 2019 12:02:48 +0000 (14:02 +0200)
committerConnor Abbott <cwabbott0@gmail.com>
Wed, 9 Oct 2019 17:55:25 +0000 (17:55 +0000)
commitaf9296b8c075d109426ecd1686211088e618103e
tree4411287f689f0a50103bf45071f137f8bd5ebeae
parentb049ebcf90f498f6005701b4fceb9c43e115e4b1
nir/sink: Rewrite loop handling logic

Previously, for code like:
loop {
    loop {
        a = load_ubo()
    }
    use(a)
}
adjust_block_for_loops() would return the block before the first loop.
Now we compute the range of allowed blocks and then walk the dominance
tree directly, guaranteeing directly that we always choose a block that
dominates all the uses and is dominated by the definition.

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
src/compiler/nir/nir_opt_sink.c