nir: make opt_if_loop_terminator() less strict
authorTimothy Arceri <tarceri@itsqueeze.com>
Tue, 7 Apr 2020 13:33:55 +0000 (23:33 +1000)
committerMarge Bot <eric+marge@anholt.net>
Wed, 8 Apr 2020 01:35:45 +0000 (01:35 +0000)
nir_cf_{extract,reinsert}() can't stitch a block together
if the block we are extracting ends in a jump but other jumps
nested in further ifs should be fine to move.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4477>

src/compiler/nir/nir_opt_if.c

index 75e4244cb2f56a360e048b77e22f288d2b9c8ce8..9460cefb79be9dbe68d04879f0c662e9f86e6390 100644 (file)
@@ -998,7 +998,7 @@ opt_if_loop_terminator(nir_if *nif)
    if (is_block_empty(first_continue_from_blk))
       return false;
 
-   if (!nir_is_trivial_loop_if(nif, break_blk))
+   if (nir_block_ends_in_jump(continue_from_blk))
       return false;
 
    /* Even though this if statement has a jump on one side, we may still have