nir/opt_undef: Handle a couple more normal store intrinsics.
[mesa.git] / src / compiler / nir / nir_opt_undef.c
index 1f939e82c68e25f188cc515add2f9daccc47437d..e03e5b88efc6bb2629fddcd63c2b799f05d58291 100644 (file)
@@ -77,10 +77,7 @@ opt_undef_csel(nir_alu_instr *instr)
 static bool
 opt_undef_vecN(nir_builder *b, nir_alu_instr *alu)
 {
-   if (alu->op != nir_op_vec2 &&
-       alu->op != nir_op_vec3 &&
-       alu->op != nir_op_vec4 &&
-       alu->op != nir_op_mov)
+   if (!nir_op_is_vec(alu->op))
       return false;
 
    assert(alu->dest.dest.is_ssa);
@@ -115,6 +112,8 @@ opt_undef_store(nir_intrinsic_instr *intrin)
    case nir_intrinsic_store_per_vertex_output:
    case nir_intrinsic_store_ssbo:
    case nir_intrinsic_store_shared:
+   case nir_intrinsic_store_global:
+   case nir_intrinsic_store_scratch:
       arg_index =  0;
       break;
    default:
@@ -158,9 +157,7 @@ nir_opt_undef(nir_shader *shader)
                                   nir_metadata_block_index |
                                   nir_metadata_dominance);
          } else {
-#ifndef NDEBUG
-            function->impl->valid_metadata &= ~nir_metadata_not_properly_reset;
-#endif
+            nir_metadata_preserve(function->impl, nir_metadata_all);
          }
       }
    }