nir: Allow more deref modes in phis
authorJason Ekstrand <jason@jlekstrand.net>
Thu, 8 Oct 2020 04:05:25 +0000 (23:05 -0500)
committerMarge Bot <eric+marge@anholt.net>
Sun, 11 Oct 2020 21:50:23 +0000 (21:50 +0000)
In particular, OpenCL needs to allow shader_temp and function_temp
through because they're 100% real pointers.

Fixes piglit CL calls.cl

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7092>

.gitlab-ci/piglit/cl.txt
src/compiler/nir/nir_validate.c

index ba0f057..d10de8a 100644 (file)
@@ -179,7 +179,6 @@ program/execute/builtin/builtin-ushort-mul_hi-1.0.generated/mul_hi ushort8: fail
 program/execute/builtin/builtin-ushort-popcount-1.2.generated: skip
 program/execute/builtin/builtin-ushort-upsample-1.0.generated: crash
 program/execute/call-clobbers-amdgcn: skip
-program/execute/calls: crash
 program/execute/calls-large-struct: crash
 program/execute/calls-struct: crash
 program/execute/gegl-rgb-gamma-u8-to-ragabaf: crash
@@ -246,9 +245,9 @@ program/execute/vstore/vstorea_half-float-private: crash
 summary:
        name:  results
        ----  --------
-       pass:     2964
+       pass:     2967
        fail:       99
-      crash:       66
+      crash:       65
        skip:       79
     timeout:        1
        warn:        0
@@ -258,4 +257,4 @@ summary:
     changes:        0
       fixes:        0
 regressions:        0
-      total:     3209
+      total:     3211
index 962d7ae..a4bc1ab 100644 (file)
@@ -513,14 +513,15 @@ validate_deref_instr(nir_deref_instr *instr, validate_state *state)
     */
    validate_assert(state, list_is_empty(&instr->dest.ssa.if_uses));
 
-   /* Only certain modes can be used as sources for phi instructions. */
+   /* Certain modes cannot be used as sources for phi instructions because
+    * way too many passes assume that they can always chase deref chains.
+    */
    nir_foreach_use(use, &instr->dest.ssa) {
       if (use->parent_instr->type == nir_instr_type_phi) {
-         validate_assert(state, instr->mode == nir_var_mem_ubo ||
-                                instr->mode == nir_var_mem_ssbo ||
-                                instr->mode == nir_var_mem_shared ||
-                                instr->mode == nir_var_mem_global ||
-                                instr->mode == nir_var_mem_constant);
+         validate_assert(state, instr->mode != nir_var_shader_in &&
+                                instr->mode != nir_var_shader_out &&
+                                instr->mode != nir_var_shader_out &&
+                                instr->mode != nir_var_uniform);
       }
    }
 }