From 90b6dba772db4089c491471303333ecc37e31ef4 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sun, 16 Jun 2024 16:26:19 -0400 Subject: [PATCH] nir: add nir_metadata_control_flow Most passes want to preserve this specific combination of metadata, so let's add an alias for the combination. The alias communicates that the control flow graph is preserved, rather than a particular statement about e.g. dominance preservation. You don't need to understand dominance to write a simple nir_shader_instructions_pass. And since you were going to cargo cult the metadata anyway, this way you'll cargo cult a version you're more likely to understand. Signed-off-by: Alyssa Rosenzweig Acked-by: Karol Herbst Reviewed-by: Konstantin Seurer Reviewed-by: Faith Ekstrand Part-of: --- src/compiler/nir/nir.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 27f445b4cc9..aad0e3e8282 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -3322,6 +3322,18 @@ typedef enum { */ nir_metadata_instr_index = 0x20, + /** All control flow metadata + * + * This includes all metadata preserved by a pass that preserves control flow + * but modifies instructions. For example, a pass using + * nir_shader_instructions_pass will typically preserve this if it does not + * insert control flow. + * + * This is the most common metadata set to preserve, so it has its own alias. + */ + nir_metadata_control_flow = nir_metadata_block_index | + nir_metadata_dominance, + /** All metadata * * This includes all nir_metadata flags except not_properly_reset. Passes