lima: run opt_algebraic between int_to_float and boot_to_float for vs
authorVasily Khoruzhick <anarsoul@gmail.com>
Wed, 4 Sep 2019 05:55:48 +0000 (22:55 -0700)
committerVasily Khoruzhick <anarsoul@gmail.com>
Mon, 9 Sep 2019 17:25:30 +0000 (10:25 -0700)
int_to_float emits ftrunc and ftrunc lowering generates bool ops.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Erico Nunes <nunes.erico@gmail.com>
Reviewed-by: Andreas Baierl <ichgeh@imkreisrum.de>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
src/gallium/drivers/lima/lima_program.c

index f92c64a300d317b355a1d24fbfab1beef93b5eb9..e3863feb80efa340c02e130f8ec28b60a918557e 100644 (file)
@@ -129,15 +129,16 @@ lima_program_optimize_vs_nir(struct nir_shader *s)
    } while (progress);
 
    NIR_PASS_V(s, nir_lower_int_to_float);
-   NIR_PASS_V(s, nir_lower_bool_to_float);
-
-   /* Some ops must be lowered after being converted from int ops,
-    * so re-run nir_opt_algebraic after int lowering. */
+   /* Run opt_algebraic between int_to_float and bool_to_float because
+    * int_to_float emits ftrunc, and ftrunc lowering generates bool ops
+    */
    do {
       progress = false;
       NIR_PASS(progress, s, nir_opt_algebraic);
    } while (progress);
 
+   NIR_PASS_V(s, nir_lower_bool_to_float);
+
    NIR_PASS_V(s, nir_copy_prop);
    NIR_PASS_V(s, nir_opt_dce);
    NIR_PASS_V(s, nir_lower_locals_to_regs);