[Mesa-dev] [PATCH 002.1/129] FIXUP! Check the deref type first in is_trivial_deref_cast

Jason Ekstrand jason at jlekstrand.net
Fri Jun 1 19:38:34 UTC 2018


---
 src/compiler/nir/nir_opt_copy_propagate.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/compiler/nir/nir_opt_copy_propagate.c b/src/compiler/nir/nir_opt_copy_propagate.c
index c35e8e1..c8821c3 100644
--- a/src/compiler/nir/nir_opt_copy_propagate.c
+++ b/src/compiler/nir/nir_opt_copy_propagate.c
@@ -101,11 +101,11 @@ is_swizzleless_move(nir_alu_instr *instr)
 static bool
 is_trivial_deref_cast(nir_deref_instr *cast)
 {
-   nir_deref_instr *parent = nir_src_as_deref(cast->parent);
-   if (!parent)
+   if (cast->deref_type != nir_deref_type_cast)
       return false;
 
-   if (cast->deref_type != nir_deref_type_cast)
+   nir_deref_instr *parent = nir_src_as_deref(cast->parent);
+   if (!parent)
       return false;
 
    return cast->mode == parent->mode &&
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list