From 093e68b518209e68c4d4d076a5cd76ee84181158 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timur=20Krist=C3=B3f?= Date: Tue, 18 Feb 2025 17:21:39 +0100 Subject: [PATCH] compiler/clc: Stop using deprecated NIR_PASS_V macro. Reviewed-by: Alyssa Rosenzweig Part-of: --- src/compiler/clc/nir_load_libclc.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/compiler/clc/nir_load_libclc.c b/src/compiler/clc/nir_load_libclc.c index 87e74e4063c..10840f98641 100644 --- a/src/compiler/clc/nir_load_libclc.c +++ b/src/compiler/clc/nir_load_libclc.c @@ -252,9 +252,11 @@ nir_can_find_libclc(unsigned ptr_bit_size) * every function that works on global memory and make it also work on generic * memory. */ -static void +static bool libclc_add_generic_variants(nir_shader *shader) { + bool progress = false; + nir_foreach_function(func, shader) { /* These don't need generic variants */ if (strstr(func->name, "async_work_group_strided_copy")) @@ -299,8 +301,20 @@ libclc_add_generic_variants(nir_shader *shader) } } - nir_metadata_preserve(gfunc->impl, nir_metadata_none); + progress = true; + nir_metadata_preserve(func->impl, nir_metadata_none); } + + if (progress) { + nir_foreach_function_impl(impl, shader) { + if (impl->valid_metadata & nir_metadata_not_properly_reset) { + /* Preserve all metadata for functions that we didn't modify. */ + nir_metadata_preserve(impl, nir_metadata_all); + } + } + } + + return progress; } nir_shader * @@ -355,16 +369,16 @@ nir_load_libclc_shader(unsigned ptr_bit_size, * initializers and lower any early returns. */ nir->info.internal = true; - NIR_PASS_V(nir, nir_lower_variable_initializers, nir_var_function_temp); - NIR_PASS_V(nir, nir_lower_returns); + NIR_PASS(_, nir, nir_lower_variable_initializers, nir_var_function_temp); + NIR_PASS(_, nir, nir_lower_returns); - NIR_PASS_V(nir, libclc_add_generic_variants); + NIR_PASS(_, nir, libclc_add_generic_variants); /* Run some optimization passes. Those used here should be considered safe * for all use cases and drivers. */ if (optimize) { - NIR_PASS_V(nir, nir_split_var_copies); + NIR_PASS(_, nir, nir_split_var_copies); bool progress; do {