From 1e51383258ee48f6af8745d99638f4b45b8c52f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tapani=20P=C3=A4lli?= Date: Wed, 19 Oct 2022 11:48:38 +0300 Subject: [PATCH] intel/compiler: run nir_opt_idiv_const before nir_lower_idiv MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Integer div lowering can potentially create a lot of code that is not removed later on. Running const lowering pass first can be used to eliminate that code. Signed-off-by: Tapani Pälli Reviewed-by: Lionel Landwerlin Reviewed-by: Marcin Ślusarz Part-of: --- src/intel/compiler/brw_nir.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c index d21b3a4aba7..aa47e597523 100644 --- a/src/intel/compiler/brw_nir.c +++ b/src/intel/compiler/brw_nir.c @@ -1251,6 +1251,8 @@ brw_postprocess_nir(nir_shader *nir, const struct brw_compiler *compiler, } while (progress); if (devinfo->verx10 >= 125) { + /* Lower integer division by constants before nir_lower_idiv. */ + OPT(nir_opt_idiv_const, 32); const nir_lower_idiv_options options = { .imprecise_32bit_lowering = false, .allow_fp16 = false