From 8780f66c3ae1ebe850bfdbf9c2ce2585be836cfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timur=20Krist=C3=B3f?= Date: Thu, 20 Apr 2023 12:35:01 +0200 Subject: [PATCH] nir/opt_dead_cf: Remove if branches with undef condition. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Treat them as if the undef were false. Reviewed-by: Marek Olšák Reviewed-by: Faith Ekstrand Part-of: --- src/compiler/nir/nir_opt_dead_cf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/compiler/nir/nir_opt_dead_cf.c b/src/compiler/nir/nir_opt_dead_cf.c index 352c6f8ff17..45141856057 100644 --- a/src/compiler/nir/nir_opt_dead_cf.c +++ b/src/compiler/nir/nir_opt_dead_cf.c @@ -285,6 +285,9 @@ dead_cf_block(nir_block *block) if (nir_src_is_const(following_if->condition)) { opt_constant_if(following_if, nir_src_as_bool(following_if->condition)); return true; + } else if (nir_src_is_undef(following_if->condition)) { + opt_constant_if(following_if, false); + return true; } if (node_is_dead(&following_if->cf_node)) {