radeonsi/nir: make use of nir_lower_load_const_to_scalar()
authorTimothy Arceri <tarceri@itsqueeze.com>
Mon, 16 Jul 2018 04:01:40 +0000 (14:01 +1000)
committerTimothy Arceri <tarceri@itsqueeze.com>
Sun, 22 Jul 2018 23:48:51 +0000 (09:48 +1000)
This allows NIR to CSE more operations. LLVM does this also so the
impact is limited, however doing this in NIR allows other opts to
make progress. For example some loops in Civilization Beyond Earth
shaders are unrolled.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/radeonsi/si_shader_nir.c

index 6eb114ad5c086870c1f492b89d0a4a56f7f47efa..4ae5b0065938a0545599b7199fef50f7430d698b 100644 (file)
@@ -802,6 +802,8 @@ si_lower_nir(struct si_shader_selector* sel)
 
        ac_lower_indirect_derefs(sel->nir, sel->screen->info.chip_class);
 
+       NIR_PASS_V(sel->nir, nir_lower_load_const_to_scalar);
+
        bool progress;
        do {
                progress = false;