From 114bf6995642adab2003e1e5bbe716a68fdc5e28 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 31 Jul 2025 09:39:07 -0400 Subject: [PATCH] nir: add nir_def_block helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Another common composition. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Emma Anholt Reviewed-by: Marek Olšák Acked-by: Karol Herbst Reviewed-by: Konstantin Seurer Part-of: --- src/compiler/nir/nir.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index e24c58bcdec..70f0a913664 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -1019,6 +1019,12 @@ typedef struct nir_def { bool loop_invariant; } nir_def; +static inline nir_block * +nir_def_block(nir_def *def) +{ + return def->parent_instr->block; +} + typedef struct nir_src { /* Instruction or if-statement that consumes this value as a source. This * should only be accessed through nir_src_* helpers.