From ebec182b043757690f8fa4a6ca657c52805cbedc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Thu, 28 Nov 2024 08:58:39 -0500 Subject: [PATCH] nir/algebraic: use is_used_once for comparison patterns otherwise we are just creating new instructions while not removing any Reviewed-by: Rhys Perry Part-of: --- src/compiler/nir/nir_opt_algebraic.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index 2e4403e01d1..b3235c4e390 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -2636,9 +2636,11 @@ for bit_size in [8, 16, 32, 64]: invert = OrderedDict([('feq', 'fneu'), ('fneu', 'feq')]) for left, right in itertools.combinations_with_replacement(invert.keys(), 2): - optimizations.append((('inot', ('ior(is_used_once)', (left, a, b), (right, c, d))), + optimizations.append((('inot', ('ior(is_used_once)', (left + '(is_used_once)', a, b), + (right + '(is_used_once)', c, d))), ('iand', (invert[left], a, b), (invert[right], c, d)))) - optimizations.append((('inot', ('iand(is_used_once)', (left, a, b), (right, c, d))), + optimizations.append((('inot', ('iand(is_used_once)', (left + '(is_used_once)', a, b), + (right + '(is_used_once)', c, d))), ('ior', (invert[left], a, b), (invert[right], c, d)))) # Optimize x2yN(b2x(x)) -> b2y