nir: copy intrinsic type when lowering load input/uniform and store output
[mesa.git] / src / compiler / nir / nir_opt_gcm.c
index 9d7f59c8b33a0336c8619f96377bf48dc8eb1f3d..e7d3f8ec424fa352b716382caa1685fd72b820d7 100644 (file)
@@ -128,6 +128,10 @@ gcm_pin_instructions_block(nir_block *block, struct gcm_state *state)
          }
          break;
 
+      case nir_instr_type_deref:
+         instr->pass_flags = 0;
+         break;
+
       case nir_instr_type_tex:
          switch (nir_instr_as_tex(instr)->op) {
          case nir_texop_tex:
@@ -320,7 +324,7 @@ gcm_schedule_late_def(nir_ssa_def *def, void *void_state)
    if (lca == NULL)
       return true;
 
-   /* We know have the LCA of all of the uses.  If our invariants hold,
+   /* We now have the LCA of all of the uses.  If our invariants hold,
     * this is dominated by the block that we chose when scheduling early.
     * We now walk up the dominance tree and pick the lowest block that is
     * as far outside loops as we can get.
@@ -456,6 +460,9 @@ gcm_place_instr(nir_instr *instr, struct gcm_state *state)
 static bool
 opt_gcm_impl(nir_function_impl *impl, bool value_number)
 {
+   nir_metadata_require(impl, nir_metadata_block_index |
+                              nir_metadata_dominance);
+
    struct gcm_state state;
 
    state.impl = impl;
@@ -463,9 +470,6 @@ opt_gcm_impl(nir_function_impl *impl, bool value_number)
    exec_list_make_empty(&state.instrs);
    state.blocks = rzalloc_array(NULL, struct gcm_block_info, impl->num_blocks);
 
-   nir_metadata_require(impl, nir_metadata_block_index |
-                              nir_metadata_dominance);
-
    gcm_build_block_info(&impl->body, &state, 0);
 
    nir_foreach_block(block, impl) {