radv: call nir_opt_algebraic_late() after lowering idiv for small bitsizes
authorDaniel Schürmann <daniel@schuermann.dev>
Mon, 11 Jan 2021 13:34:26 +0000 (14:34 +0100)
committerMarge Bot <eric+marge@anholt.net>
Tue, 12 Jan 2021 16:14:00 +0000 (16:14 +0000)
This is needed because lower_idiv() introduces ineg again
which we'll remove next.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8425>

src/amd/vulkan/radv_pipeline.c

index dfd697d..0e5ea19 100644 (file)
@@ -3367,9 +3367,11 @@ VkResult radv_create_shaders(struct radv_pipeline *pipeline,
                                }
 
                                if (nir_lower_bit_size(nir[i], lower_bit_size_callback, device)) {
-                                       nir_lower_idiv(nir[i], nir_lower_idiv_precise);
-                                       nir_opt_constant_folding(nir[i]);
-                                       nir_opt_dce(nir[i]);
+                                       // TODO: lower idiv beforehand
+                                       if (nir_lower_idiv(nir[i], nir_lower_idiv_precise))
+                                               NIR_PASS_V(nir[i], nir_opt_algebraic_late); /* needed for removing ineg again */
+                                       NIR_PASS_V(nir[i], nir_opt_constant_folding);
+                                       NIR_PASS_V(nir[i], nir_opt_dce);
                                }
 
                                if (device->physical_device->rad_info.chip_class >= GFX8)