From 987a0e6a67c856be207364ada4b838073710ba7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Mon, 11 Jan 2021 14:34:26 +0100 Subject: [PATCH] radv: call nir_opt_algebraic_late() after lowering idiv for small bitsizes This is needed because lower_idiv() introduces ineg again which we'll remove next. Reviewed-by: Rhys Perry Part-of: --- src/amd/vulkan/radv_pipeline.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c index dfd697d5f9a..0e5ea1981dd 100644 --- a/src/amd/vulkan/radv_pipeline.c +++ b/src/amd/vulkan/radv_pipeline.c @@ -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)