From 0e679e80a96ce916b9c2e0da993878ce512c9621 Mon Sep 17 00:00:00 2001 From: Konstantin Seurer Date: Sun, 7 May 2023 11:53:21 +0200 Subject: [PATCH] nir/lower_io: Emit less iadd(x, 0) Reviewed-by: Faith Ekstrand Reviewed-by: Emma Anholt Part-of: --- src/compiler/nir/nir_lower_io.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c index ec8b6bf..2838807 100644 --- a/src/compiler/nir/nir_lower_io.c +++ b/src/compiler/nir/nir_lower_io.c @@ -908,6 +908,9 @@ build_addr_iadd_imm(nir_builder *b, nir_ssa_def *addr, nir_variable_mode modes, int64_t offset) { + if (!offset) + return addr; + return build_addr_iadd(b, addr, addr_format, modes, nir_imm_intN_t(b, offset, addr_get_offset_bit_size(addr, addr_format))); -- 2.7.4