From fff78fc1c58aa1a63c72dc015e58345a9c9e1d66 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Sun, 1 Nov 2020 17:15:28 -0600 Subject: [PATCH] nir/phis_to_scalar,gcm: Use nir_deref_mode_may_be In both cases, we're trying to determine if a load is scalarizable. We don't want to scalarize if it's a function_temp or shader_temp because it might turn into something we can't scalarize. Reviewed-by: Jesse Natalie Reviewed-by: Caio Marcelo de Oliveira Filho Part-of: --- src/compiler/nir/nir_lower_phis_to_scalar.c | 4 ++-- src/compiler/nir/nir_opt_gcm.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler/nir/nir_lower_phis_to_scalar.c b/src/compiler/nir/nir_lower_phis_to_scalar.c index d0f9a8b020f..a2216fc65fe 100644 --- a/src/compiler/nir/nir_lower_phis_to_scalar.c +++ b/src/compiler/nir/nir_lower_phis_to_scalar.c @@ -91,8 +91,8 @@ is_phi_src_scalarizable(nir_phi_src *src, * might turn into one of the things we can't scalarize. */ nir_deref_instr *deref = nir_src_as_deref(src_intrin->src[0]); - return !(deref->mode & (nir_var_function_temp | - nir_var_shader_temp)); + return !nir_deref_mode_may_be(deref, nir_var_function_temp | + nir_var_shader_temp); } case nir_intrinsic_interp_deref_at_centroid: diff --git a/src/compiler/nir/nir_opt_gcm.c b/src/compiler/nir/nir_opt_gcm.c index 27c1fd877fe..0ec98407bfe 100644 --- a/src/compiler/nir/nir_opt_gcm.c +++ b/src/compiler/nir/nir_opt_gcm.c @@ -146,8 +146,8 @@ is_src_scalarizable(nir_src *src) * might turn into one of the things we can't scalarize. */ nir_deref_instr *deref = nir_src_as_deref(src_intrin->src[0]); - return !(deref->mode & (nir_var_function_temp | - nir_var_shader_temp)); + return !nir_deref_mode_may_be(deref, (nir_var_function_temp | + nir_var_shader_temp)); } case nir_intrinsic_interp_deref_at_centroid: