<div dir="ltr"><div>Assuming it builds everywhere (probably best to double-check before pushing anything)</div><div><br></div><div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Dec 4, 2018 at 12:27 PM Karol Herbst <<a href="mailto:kherbst@redhat.com">kherbst@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">the naming is a bit confusing no matter how you look at it. Within SPIR-V<br>
"global" memory is memory accessible from all threads. glsl "global" memory<br>
normally refers to shader thread private memory declared at global scope. As<br>
we already use "shared" for memory shared across all thrads of a work group<br>
the solution where everybody could be happy with is to rename "global" to<br>
"private" and use "global" later for memory usually stored within system<br>
accessible memory (be it VRAM or system RAM if keeping SVM in mind).<br>
glsl "local" memory is memory only accessible within a function, while SPIR-V<br>
"local" memory is memory accessible within the same workgroup.<br>
<br>
v2: rename local to function as well<br>
<br>
Signed-off-by: Karol Herbst <<a href="mailto:kherbst@redhat.com" target="_blank">kherbst@redhat.com</a>><br>
---<br>
 src/amd/common/ac_nir_to_llvm.c               |  6 ++--<br>
 src/amd/vulkan/radv_shader.c                  |  8 ++---<br>
 src/compiler/glsl/glsl_to_nir.cpp             | 10 +++----<br>
 src/compiler/nir/nir.c                        |  6 ++--<br>
 src/compiler/nir/nir.h                        |  8 ++---<br>
 src/compiler/nir/nir_linking_helpers.c        |  2 +-<br>
 src/compiler/nir/nir_lower_clip.c             |  2 +-<br>
 .../nir/nir_lower_constant_initializers.c     |  6 ++--<br>
 .../nir/nir_lower_global_vars_to_local.c      |  6 ++--<br>
 .../nir/nir_lower_io_to_temporaries.c         |  2 +-<br>
 src/compiler/nir/nir_lower_locals_to_regs.c   |  4 +--<br>
 src/compiler/nir/nir_lower_vars_to_ssa.c      |  8 ++---<br>
 src/compiler/nir/nir_opt_copy_prop_vars.c     |  8 ++---<br>
 src/compiler/nir/nir_opt_dead_write_vars.c    |  4 +--<br>
 src/compiler/nir/nir_opt_find_array_copies.c  |  4 +--<br>
 src/compiler/nir/nir_opt_large_constants.c    | 14 ++++-----<br>
 src/compiler/nir/nir_print.c                  |  8 ++---<br>
 src/compiler/nir/nir_remove_dead_variables.c  |  6 ++--<br>
 src/compiler/nir/nir_split_vars.c             | 30 +++++++++----------<br>
 src/compiler/nir/nir_validate.c               |  2 +-<br>
 src/compiler/nir/tests/vars_tests.cpp         | 18 +++++------<br>
 src/compiler/spirv/vtn_cfg.c                  |  2 +-<br>
 src/compiler/spirv/vtn_private.h              |  2 +-<br>
 src/compiler/spirv/vtn_variables.c            |  8 ++---<br>
 src/freedreno/ir3/ir3_nir.c                   |  2 +-<br>
 src/gallium/auxiliary/nir/tgsi_to_nir.c       |  2 +-<br>
 src/gallium/drivers/v3d/v3d_program.c         |  2 +-<br>
 src/gallium/drivers/vc4/vc4_program.c         |  4 +--<br>
 src/intel/compiler/brw_nir.c                  | 10 +++----<br>
 src/intel/vulkan/anv_pipeline.c               |  4 +--<br>
 src/mesa/main/glspirv.c                       |  2 +-<br>
 src/mesa/state_tracker/st_glsl_to_nir.cpp     |  4 +--<br>
 32 files changed, 102 insertions(+), 102 deletions(-)<br>
<br>
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c<br>
index 18e9b69f3c0..2d8a27a0ab9 100644<br>
--- a/src/amd/common/ac_nir_to_llvm.c<br>
+++ b/src/amd/common/ac_nir_to_llvm.c<br>
@@ -1923,7 +1923,7 @@ static LLVMValueRef visit_load_var(struct ac_nir_context *ctx,<br>
                                values[chan] = ctx->abi->inputs[idx + chan + const_index * stride];<br>
                }<br>
                break;<br>
-       case nir_var_local:<br>
+       case nir_var_function:<br>
                for (unsigned chan = 0; chan < ve; chan++) {<br>
                        if (indir_index) {<br>
                                unsigned count = glsl_count_attribute_slots(<br>
@@ -2055,7 +2055,7 @@ visit_store_var(struct ac_nir_context *ctx,<br>
                        }<br>
                }<br>
                break;<br>
-       case nir_var_local:<br>
+       case nir_var_function:<br>
                for (unsigned chan = 0; chan < 8; chan++) {<br>
                        if (!(writemask & (1 << chan)))<br>
                                continue;<br>
@@ -4061,7 +4061,7 @@ ac_lower_indirect_derefs(struct nir_shader *nir, enum chip_class chip_class)<br>
         * See the following thread for more details of the problem:<br>
         * <a href="https://lists.freedesktop.org/archives/mesa-dev/2017-July/162106.html" rel="noreferrer" target="_blank">https://lists.freedesktop.org/archives/mesa-dev/2017-July/162106.html</a><br>
         */<br>
-       indirect_mask |= nir_var_local;<br>
+       indirect_mask |= nir_var_function;<br>
<br>
        nir_lower_indirect_derefs(nir, indirect_mask);<br>
 }<br>
diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c<br>
index 456c462a230..fa15478ad2d 100644<br>
--- a/src/amd/vulkan/radv_shader.c<br>
+++ b/src/amd/vulkan/radv_shader.c<br>
@@ -126,8 +126,8 @@ radv_optimize_nir(struct nir_shader *shader, bool optimize_conservatively,<br>
         do {<br>
                 progress = false;<br>
<br>
-               NIR_PASS(progress, shader, nir_split_array_vars, nir_var_local);<br>
-               NIR_PASS(progress, shader, nir_shrink_vec_array_vars, nir_var_local);<br>
+               NIR_PASS(progress, shader, nir_split_array_vars, nir_var_function);<br>
+               NIR_PASS(progress, shader, nir_shrink_vec_array_vars, nir_var_function);<br>
<br>
                 NIR_PASS_V(shader, nir_lower_vars_to_ssa);<br>
                NIR_PASS_V(shader, nir_lower_pack);<br>
@@ -261,7 +261,7 @@ radv_shader_compile_to_nir(struct radv_device *device,<br>
                 * inline functions.  That way they get properly initialized at the top<br>
                 * of the function and not at the top of its caller.<br>
                 */<br>
-               NIR_PASS_V(nir, nir_lower_constant_initializers, nir_var_local);<br>
+               NIR_PASS_V(nir, nir_lower_constant_initializers, nir_var_function);<br>
                NIR_PASS_V(nir, nir_lower_returns);<br>
                NIR_PASS_V(nir, nir_inline_functions);<br>
                NIR_PASS_V(nir, nir_copy_prop);<br>
@@ -323,7 +323,7 @@ radv_shader_compile_to_nir(struct radv_device *device,<br>
        nir_split_var_copies(nir);<br>
<br>
        nir_lower_global_vars_to_local(nir);<br>
-       nir_remove_dead_variables(nir, nir_var_local);<br>
+       nir_remove_dead_variables(nir, nir_var_function);<br>
        nir_lower_subgroups(nir, &(struct nir_lower_subgroups_options) {<br>
                        .subgroup_size = 64,<br>
                        .ballot_bit_size = 64,<br>
diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp<br>
index 5e70d230550..259806f03c9 100644<br>
--- a/src/compiler/glsl/glsl_to_nir.cpp<br>
+++ b/src/compiler/glsl/glsl_to_nir.cpp<br>
@@ -310,16 +310,16 @@ nir_visitor::visit(ir_variable *ir)<br>
    case ir_var_auto:<br>
    case ir_var_temporary:<br>
       if (is_global)<br>
-         var->data.mode = nir_var_global;<br>
+         var->data.mode = nir_var_private;<br>
       else<br>
-         var->data.mode = nir_var_local;<br>
+         var->data.mode = nir_var_function;<br>
       break;<br>
<br>
    case ir_var_function_in:<br>
    case ir_var_function_out:<br>
    case ir_var_function_inout:<br>
    case ir_var_const_in:<br>
-      var->data.mode = nir_var_local;<br>
+      var->data.mode = nir_var_function;<br>
       break;<br>
<br>
    case ir_var_shader_in:<br>
@@ -445,7 +445,7 @@ nir_visitor::visit(ir_variable *ir)<br>
<br>
    var->interface_type = ir->get_interface_type();<br>
<br>
-   if (var->data.mode == nir_var_local)<br>
+   if (var->data.mode == nir_var_function)<br>
       nir_function_impl_add_variable(impl, var);<br>
    else<br>
       nir_shader_add_variable(shader, var);<br>
@@ -1444,7 +1444,7 @@ nir_visitor::visit(ir_expression *ir)<br>
           * sense, we'll just turn it into a load which will probably<br>
           * eventually end up as an SSA definition.<br>
           */<br>
-         assert(this->deref->mode == nir_var_global);<br>
+         assert(this->deref->mode == nir_var_private);<br>
          op = nir_intrinsic_load_deref;<br>
       }<br>
<br>
diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c<br>
index 03199856cc2..45c4a3e8375 100644<br>
--- a/src/compiler/nir/nir.c<br>
+++ b/src/compiler/nir/nir.c<br>
@@ -125,11 +125,11 @@ nir_shader_add_variable(nir_shader *shader, nir_variable *var)<br>
       assert(!"invalid mode");<br>
       break;<br>
<br>
-   case nir_var_local:<br>
+   case nir_var_function:<br>
       assert(!"nir_shader_add_variable cannot be used for local variables");<br>
       break;<br>
<br>
-   case nir_var_global:<br>
+   case nir_var_private:<br>
       exec_list_push_tail(&shader->globals, &var->node);<br>
       break;<br>
<br>
@@ -188,7 +188,7 @@ nir_local_variable_create(nir_function_impl *impl,<br>
    nir_variable *var = rzalloc(impl->function->shader, nir_variable);<br>
    var->name = ralloc_strdup(var, name);<br>
    var->type = type;<br>
-   var->data.mode = nir_var_local;<br>
+   var->data.mode = nir_var_function;<br>
<br>
    nir_function_impl_add_variable(impl, var);<br>
<br>
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h<br>
index a111e87ed71..30d22fb9d7d 100644<br>
--- a/src/compiler/nir/nir.h<br>
+++ b/src/compiler/nir/nir.h<br>
@@ -97,8 +97,8 @@ typedef struct {<br>
 typedef enum {<br>
    nir_var_shader_in       = (1 << 0),<br>
    nir_var_shader_out      = (1 << 1),<br>
-   nir_var_global          = (1 << 2),<br>
-   nir_var_local           = (1 << 3),<br>
+   nir_var_private         = (1 << 2),<br>
+   nir_var_function        = (1 << 3),<br>
    nir_var_uniform         = (1 << 4),<br>
    nir_var_shader_storage  = (1 << 5),<br>
    nir_var_system_value    = (1 << 6),<br>
@@ -439,7 +439,7 @@ typedef struct nir_variable {<br>
 static inline bool<br>
 nir_variable_is_global(const nir_variable *var)<br>
 {<br>
-   return var->data.mode != nir_var_local;<br>
+   return var->data.mode != nir_var_function;<br>
 }<br>
<br>
 typedef struct nir_register {<br>
@@ -2291,7 +2291,7 @@ void nir_shader_add_variable(nir_shader *shader, nir_variable *var);<br>
 static inline void<br>
 nir_function_impl_add_variable(nir_function_impl *impl, nir_variable *var)<br>
 {<br>
-   assert(var->data.mode == nir_var_local);<br>
+   assert(var->data.mode == nir_var_function);<br>
    exec_list_push_tail(&impl->locals, &var->node);<br>
 }<br>
<br>
diff --git a/src/compiler/nir/nir_linking_helpers.c b/src/compiler/nir/nir_linking_helpers.c<br>
index a05890ada43..d8358e08e5a 100644<br>
--- a/src/compiler/nir/nir_linking_helpers.c<br>
+++ b/src/compiler/nir/nir_linking_helpers.c<br>
@@ -134,7 +134,7 @@ nir_remove_unused_io_vars(nir_shader *shader, struct exec_list *var_list,<br>
       if (!(other_stage & get_variable_io_mask(var, shader->info.stage))) {<br>
          /* This one is invalid, make it a global variable instead */<br>
          var->data.location = 0;<br>
-         var->data.mode = nir_var_global;<br>
+         var->data.mode = nir_var_private;<br>
<br>
          exec_node_remove(&var->node);<br>
          exec_list_push_tail(&shader->globals, &var->node);<br>
diff --git a/src/compiler/nir/nir_lower_clip.c b/src/compiler/nir/nir_lower_clip.c<br>
index 880d65c617b..6fdf1a9b008 100644<br>
--- a/src/compiler/nir/nir_lower_clip.c<br>
+++ b/src/compiler/nir/nir_lower_clip.c<br>
@@ -212,7 +212,7 @@ nir_lower_clip_vs(nir_shader *shader, unsigned ucp_enables, bool use_vars)<br>
<br>
       if (clipvertex) {<br>
          exec_node_remove(&clipvertex->node);<br>
-         clipvertex->data.mode = nir_var_global;<br>
+         clipvertex->data.mode = nir_var_private;<br>
          exec_list_push_tail(&shader->globals, &clipvertex->node);<br>
       }<br>
    } else {<br>
diff --git a/src/compiler/nir/nir_lower_constant_initializers.c b/src/compiler/nir/nir_lower_constant_initializers.c<br>
index 4e9cea46157..b213576bbd5 100644<br>
--- a/src/compiler/nir/nir_lower_constant_initializers.c<br>
+++ b/src/compiler/nir/nir_lower_constant_initializers.c<br>
@@ -92,13 +92,13 @@ nir_lower_constant_initializers(nir_shader *shader, nir_variable_mode modes)<br>
    bool progress = false;<br>
<br>
    nir_builder builder;<br>
-   if (modes & ~nir_var_local)<br>
+   if (modes & ~nir_var_function)<br>
       nir_builder_init(&builder, nir_shader_get_entrypoint(shader));<br>
<br>
    if (modes & nir_var_shader_out)<br>
       progress |= lower_const_initializer(&builder, &shader->outputs);<br>
<br>
-   if (modes & nir_var_global)<br>
+   if (modes & nir_var_private)<br>
       progress |= lower_const_initializer(&builder, &shader->globals);<br>
<br>
    if (modes & nir_var_system_value)<br>
@@ -114,7 +114,7 @@ nir_lower_constant_initializers(nir_shader *shader, nir_variable_mode modes)<br>
       }<br>
    }<br>
<br>
-   if (modes & nir_var_local) {<br>
+   if (modes & nir_var_function) {<br>
       nir_foreach_function(function, shader) {<br>
          if (!function->impl)<br>
             continue;<br>
diff --git a/src/compiler/nir/nir_lower_global_vars_to_local.c b/src/compiler/nir/nir_lower_global_vars_to_local.c<br>
index be99cf9ad02..7cc1b2cb69e 100644<br>
--- a/src/compiler/nir/nir_lower_global_vars_to_local.c<br>
+++ b/src/compiler/nir/nir_lower_global_vars_to_local.c<br>
@@ -36,7 +36,7 @@ static void<br>
 register_var_use(nir_variable *var, nir_function_impl *impl,<br>
                  struct hash_table *var_func_table)<br>
 {<br>
-   if (var->data.mode != nir_var_global)<br>
+   if (var->data.mode != nir_var_private)<br>
       return;<br>
<br>
    struct hash_entry *entry =<br>
@@ -89,11 +89,11 @@ nir_lower_global_vars_to_local(nir_shader *shader)<br>
       nir_variable *var = (void *)entry->key;<br>
       nir_function_impl *impl = entry->data;<br>
<br>
-      assert(var->data.mode == nir_var_global);<br>
+      assert(var->data.mode == nir_var_private);<br>
<br>
       if (impl != NULL) {<br>
          exec_node_remove(&var->node);<br>
-         var->data.mode = nir_var_local;<br>
+         var->data.mode = nir_var_function;<br>
          exec_list_push_tail(&impl->locals, &var->node);<br>
          nir_metadata_preserve(impl, nir_metadata_block_index |<br>
                                      nir_metadata_dominance |<br>
diff --git a/src/compiler/nir/nir_lower_io_to_temporaries.c b/src/compiler/nir/nir_lower_io_to_temporaries.c<br>
index b83aaf46e6a..2487add33ed 100644<br>
--- a/src/compiler/nir/nir_lower_io_to_temporaries.c<br>
+++ b/src/compiler/nir/nir_lower_io_to_temporaries.c<br>
@@ -134,7 +134,7 @@ create_shadow_temp(struct lower_io_state *state, nir_variable *var)<br>
    /* Give the original a new name with @<mode>-temp appended */<br>
    const char *mode = (temp->data.mode == nir_var_shader_in) ? "in" : "out";<br>
    temp->name = ralloc_asprintf(var, "%s@%s-temp", mode, nvar->name);<br>
-   temp->data.mode = nir_var_global;<br>
+   temp->data.mode = nir_var_private;<br>
    temp->data.read_only = false;<br>
    temp->data.fb_fetch_output = false;<br>
    temp->data.compact = false;<br>
diff --git a/src/compiler/nir/nir_lower_locals_to_regs.c b/src/compiler/nir/nir_lower_locals_to_regs.c<br>
index 773b7fde6d0..3b77119b6f8 100644<br>
--- a/src/compiler/nir/nir_lower_locals_to_regs.c<br>
+++ b/src/compiler/nir/nir_lower_locals_to_regs.c<br>
@@ -192,7 +192,7 @@ lower_locals_to_regs_block(nir_block *block,<br>
       switch (intrin->intrinsic) {<br>
       case nir_intrinsic_load_deref: {<br>
          nir_deref_instr *deref = nir_src_as_deref(intrin->src[0]);<br>
-         if (deref->mode != nir_var_local)<br>
+         if (deref->mode != nir_var_function)<br>
             continue;<br>
<br>
          b->cursor = nir_before_instr(&intrin->instr);<br>
@@ -218,7 +218,7 @@ lower_locals_to_regs_block(nir_block *block,<br>
<br>
       case nir_intrinsic_store_deref: {<br>
          nir_deref_instr *deref = nir_src_as_deref(intrin->src[0]);<br>
-         if (deref->mode != nir_var_local)<br>
+         if (deref->mode != nir_var_function)<br>
             continue;<br>
<br>
          b->cursor = nir_before_instr(&intrin->instr);<br>
diff --git a/src/compiler/nir/nir_lower_vars_to_ssa.c b/src/compiler/nir/nir_lower_vars_to_ssa.c<br>
index 646efd9ad89..98f3169f6ac 100644<br>
--- a/src/compiler/nir/nir_lower_vars_to_ssa.c<br>
+++ b/src/compiler/nir/nir_lower_vars_to_ssa.c<br>
@@ -208,7 +208,7 @@ get_deref_node(nir_deref_instr *deref, struct lower_variables_state *state)<br>
    /* This pass only works on local variables.  Just ignore any derefs with<br>
     * a non-local mode.<br>
     */<br>
-   if (deref->mode != nir_var_local)<br>
+   if (deref->mode != nir_var_function)<br>
       return NULL;<br>
<br>
    struct deref_node *node = get_deref_node_recur(deref, state);<br>
@@ -507,7 +507,7 @@ rename_variables(struct lower_variables_state *state)<br>
          switch (intrin->intrinsic) {<br>
          case nir_intrinsic_load_deref: {<br>
             nir_deref_instr *deref = nir_src_as_deref(intrin->src[0]);<br>
-            if (deref->mode != nir_var_local)<br>
+            if (deref->mode != nir_var_function)<br>
                continue;<br>
<br>
             struct deref_node *node = get_deref_node(deref, state);<br>
@@ -557,7 +557,7 @@ rename_variables(struct lower_variables_state *state)<br>
<br>
          case nir_intrinsic_store_deref: {<br>
             nir_deref_instr *deref = nir_src_as_deref(intrin->src[0]);<br>
-            if (deref->mode != nir_var_local)<br>
+            if (deref->mode != nir_var_function)<br>
                continue;<br>
<br>
             struct deref_node *node = get_deref_node(deref, state);<br>
@@ -685,7 +685,7 @@ nir_lower_vars_to_ssa_impl(nir_function_impl *impl)<br>
       assert(path->path[0]->deref_type == nir_deref_type_var);<br>
<br>
       /* We don't build deref nodes for non-local variables */<br>
-      assert(path->path[0]->var->data.mode == nir_var_local);<br>
+      assert(path->path[0]->var->data.mode == nir_var_function);<br>
<br>
       if (path_may_be_aliased(path, &state)) {<br>
          exec_node_remove(&node->direct_derefs_link);<br>
diff --git a/src/compiler/nir/nir_opt_copy_prop_vars.c b/src/compiler/nir/nir_opt_copy_prop_vars.c<br>
index 48070cd5e31..2bf382c96b7 100644<br>
--- a/src/compiler/nir/nir_opt_copy_prop_vars.c<br>
+++ b/src/compiler/nir/nir_opt_copy_prop_vars.c<br>
@@ -134,8 +134,8 @@ gather_vars_written(struct copy_prop_var_state *state,<br>
       nir_foreach_instr(instr, block) {<br>
          if (instr->type == nir_instr_type_call) {<br>
             written->modes |= nir_var_shader_out |<br>
-                              nir_var_global |<br>
-                              nir_var_local |<br>
+                              nir_var_private |<br>
+                              nir_var_function |<br>
                               nir_var_shader_storage |<br>
                               nir_var_shared;<br>
             continue;<br>
@@ -603,8 +603,8 @@ copy_prop_vars_block(struct copy_prop_var_state *state,<br>
    nir_foreach_instr_safe(instr, block) {<br>
       if (instr->type == nir_instr_type_call) {<br>
          apply_barrier_for_modes(copies, nir_var_shader_out |<br>
-                                         nir_var_global |<br>
-                                         nir_var_local |<br>
+                                         nir_var_private |<br>
+                                         nir_var_function |<br>
                                          nir_var_shader_storage |<br>
                                          nir_var_shared);<br>
          continue;<br>
diff --git a/src/compiler/nir/nir_opt_dead_write_vars.c b/src/compiler/nir/nir_opt_dead_write_vars.c<br>
index dd949998cc8..a66f8035107 100644<br>
--- a/src/compiler/nir/nir_opt_dead_write_vars.c<br>
+++ b/src/compiler/nir/nir_opt_dead_write_vars.c<br>
@@ -120,8 +120,8 @@ remove_dead_write_vars_local(void *mem_ctx, nir_block *block)<br>
    nir_foreach_instr_safe(instr, block) {<br>
       if (instr->type == nir_instr_type_call) {<br>
          clear_unused_for_modes(&unused_writes, nir_var_shader_out |<br>
-                                                nir_var_global |<br>
-                                                nir_var_local |<br>
+                                                nir_var_private |<br>
+                                                nir_var_function |<br>
                                                 nir_var_shader_storage |<br>
                                                 nir_var_shared);<br>
          continue;<br>
diff --git a/src/compiler/nir/nir_opt_find_array_copies.c b/src/compiler/nir/nir_opt_find_array_copies.c<br>
index 5cfcd73b6b8..40ba5e21f2c 100644<br>
--- a/src/compiler/nir/nir_opt_find_array_copies.c<br>
+++ b/src/compiler/nir/nir_opt_find_array_copies.c<br>
@@ -225,7 +225,7 @@ opt_find_array_copies_block(nir_builder *b, nir_block *block,<br>
        * continue on because it won't affect local stores or read-only<br>
        * variables.<br>
        */<br>
-      if (dst_deref->mode != nir_var_local)<br>
+      if (dst_deref->mode != nir_var_function)<br>
          continue;<br>
<br>
       /* We keep track of the SSA indices where the two last-written<br>
@@ -273,7 +273,7 @@ opt_find_array_copies_block(nir_builder *b, nir_block *block,<br>
        */<br>
       const nir_variable_mode read_only_modes =<br>
          nir_var_shader_in | nir_var_uniform | nir_var_system_value;<br>
-      if (!(src_deref->mode & (nir_var_local | read_only_modes)))<br>
+      if (!(src_deref->mode & (nir_var_function | read_only_modes)))<br>
          goto reset;<br>
<br>
       /* If we don't yet have an active copy, then make this instruction the<br>
diff --git a/src/compiler/nir/nir_opt_large_constants.c b/src/compiler/nir/nir_opt_large_constants.c<br>
index 634913aa9e5..651f89cd1e6 100644<br>
--- a/src/compiler/nir/nir_opt_large_constants.c<br>
+++ b/src/compiler/nir/nir_opt_large_constants.c<br>
@@ -174,9 +174,9 @@ nir_opt_large_constants(nir_shader *shader,<br>
             continue;<br>
          }<br>
<br>
-         if (dst_deref && dst_deref->mode == nir_var_local) {<br>
+         if (dst_deref && dst_deref->mode == nir_var_function) {<br>
             nir_variable *var = nir_deref_instr_get_variable(dst_deref);<br>
-            assert(var->data.mode == nir_var_local);<br>
+            assert(var->data.mode == nir_var_function);<br>
<br>
             /* We only consider variables constant if they only have constant<br>
              * stores, all the stores come before any reads, and all stores<br>
@@ -188,9 +188,9 @@ nir_opt_large_constants(nir_shader *shader,<br>
                info->is_constant = false;<br>
          }<br>
<br>
-         if (src_deref && src_deref->mode == nir_var_local) {<br>
+         if (src_deref && src_deref->mode == nir_var_function) {<br>
             nir_variable *var = nir_deref_instr_get_variable(src_deref);<br>
-            assert(var->data.mode == nir_var_local);<br>
+            assert(var->data.mode == nir_var_function);<br>
<br>
             var_infos[var->data.index].found_read = true;<br>
          }<br>
@@ -236,7 +236,7 @@ nir_opt_large_constants(nir_shader *shader,<br>
          switch (intrin->intrinsic) {<br>
          case nir_intrinsic_load_deref: {<br>
             nir_deref_instr *deref = nir_src_as_deref(intrin->src[0]);<br>
-            if (deref->mode != nir_var_local)<br>
+            if (deref->mode != nir_var_function)<br>
                continue;<br>
<br>
             nir_variable *var = nir_deref_instr_get_variable(deref);<br>
@@ -254,7 +254,7 @@ nir_opt_large_constants(nir_shader *shader,<br>
<br>
          case nir_intrinsic_store_deref: {<br>
             nir_deref_instr *deref = nir_src_as_deref(intrin->src[0]);<br>
-            if (deref->mode != nir_var_local)<br>
+            if (deref->mode != nir_var_function)<br>
                continue;<br>
<br>
             nir_variable *var = nir_deref_instr_get_variable(deref);<br>
@@ -270,7 +270,7 @@ nir_opt_large_constants(nir_shader *shader,<br>
<br>
          case nir_intrinsic_copy_deref: {<br>
             nir_deref_instr *deref = nir_src_as_deref(intrin->src[1]);<br>
-            if (deref->mode != nir_var_local)<br>
+            if (deref->mode != nir_var_function)<br>
                continue;<br>
<br>
             nir_variable *var = nir_deref_instr_get_variable(deref);<br>
diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c<br>
index b8549f56eb8..1d409b1da7b 100644<br>
--- a/src/compiler/nir/nir_print.c<br>
+++ b/src/compiler/nir/nir_print.c<br>
@@ -409,10 +409,10 @@ get_variable_mode_str(nir_variable_mode mode, bool want_local_global_mode)<br>
       return "system";<br>
    case nir_var_shared:<br>
       return "shared";<br>
-   case nir_var_global:<br>
-      return want_local_global_mode ? "global" : "";<br>
-   case nir_var_local:<br>
-      return want_local_global_mode ? "local" : "";<br>
+   case nir_var_private:<br>
+      return want_local_global_mode ? "private" : "";<br>
+   case nir_var_function:<br>
+      return want_local_global_mode ? "function" : "";<br>
    default:<br>
       return "";<br>
    }<br>
diff --git a/src/compiler/nir/nir_remove_dead_variables.c b/src/compiler/nir/nir_remove_dead_variables.c<br>
index fadc51a6977..d802d6a60b4 100644<br>
--- a/src/compiler/nir/nir_remove_dead_variables.c<br>
+++ b/src/compiler/nir/nir_remove_dead_variables.c<br>
@@ -71,7 +71,7 @@ add_var_use_deref(nir_deref_instr *deref, struct set *live)<br>
     * all means we need to keep it alive.<br>
     */<br>
    assert(deref->mode == deref->var->data.mode);<br>
-   if (!(deref->mode & (nir_var_local | nir_var_global | nir_var_shared)) ||<br>
+   if (!(deref->mode & (nir_var_function | nir_var_private | nir_var_shared)) ||<br>
        deref_used_for_not_store(deref))<br>
       _mesa_set_add(live, deref->var);<br>
 }<br>
@@ -175,7 +175,7 @@ nir_remove_dead_variables(nir_shader *shader, nir_variable_mode modes)<br>
    if (modes & nir_var_shader_out)<br>
       progress = remove_dead_vars(&shader->outputs, live) || progress;<br>
<br>
-   if (modes & nir_var_global)<br>
+   if (modes & nir_var_private)<br>
       progress = remove_dead_vars(&shader->globals, live) || progress;<br>
<br>
    if (modes & nir_var_system_value)<br>
@@ -184,7 +184,7 @@ nir_remove_dead_variables(nir_shader *shader, nir_variable_mode modes)<br>
    if (modes & nir_var_shared)<br>
       progress = remove_dead_vars(&shader->shared, live) || progress;<br>
<br>
-   if (modes & nir_var_local) {<br>
+   if (modes & nir_var_function) {<br>
       nir_foreach_function(function, shader) {<br>
          if (function->impl) {<br>
             if (remove_dead_vars(&function->impl->locals, live))<br>
diff --git a/src/compiler/nir/nir_split_vars.c b/src/compiler/nir/nir_split_vars.c<br>
index bf9205c5150..2586b11d680 100644<br>
--- a/src/compiler/nir/nir_split_vars.c<br>
+++ b/src/compiler/nir/nir_split_vars.c<br>
@@ -114,7 +114,7 @@ init_field_for_type(struct field *field, struct field *parent,<br>
          var_type = wrap_type_in_array(var_type, f->type);<br>
<br>
       nir_variable_mode mode = state->base_var->data.mode;<br>
-      if (mode == nir_var_local) {<br>
+      if (mode == nir_var_function) {<br>
          field->var = nir_local_variable_create(state->impl, var_type, name);<br>
       } else {<br>
          field->var = nir_variable_create(state->shader, mode, var_type, name);<br>
@@ -259,10 +259,10 @@ nir_split_struct_vars(nir_shader *shader, nir_variable_mode modes)<br>
       _mesa_hash_table_create(mem_ctx, _mesa_hash_pointer,<br>
                               _mesa_key_pointer_equal);<br>
<br>
-   assert((modes & (nir_var_global | nir_var_local)) == modes);<br>
+   assert((modes & (nir_var_private | nir_var_function)) == modes);<br>
<br>
    bool has_global_splits = false;<br>
-   if (modes & nir_var_global) {<br>
+   if (modes & nir_var_private) {<br>
       has_global_splits = split_var_list_structs(shader, NULL,<br>
                                                  &shader->globals,<br>
                                                  var_field_map, mem_ctx);<br>
@@ -274,7 +274,7 @@ nir_split_struct_vars(nir_shader *shader, nir_variable_mode modes)<br>
          continue;<br>
<br>
       bool has_local_splits = false;<br>
-      if (modes & nir_var_local) {<br>
+      if (modes & nir_var_function) {<br>
          has_local_splits = split_var_list_structs(shader, function->impl,<br>
                                                    &function->impl->locals,<br>
                                                    var_field_map, mem_ctx);<br>
@@ -453,7 +453,7 @@ create_split_array_vars(struct array_var_info *var_info,<br>
       name = ralloc_asprintf(mem_ctx, "(%s)", name);<br>
<br>
       nir_variable_mode mode = var_info->base_var->data.mode;<br>
-      if (mode == nir_var_local) {<br>
+      if (mode == nir_var_function) {<br>
          split->var = nir_local_variable_create(impl,<br>
                                                 var_info->split_var_type, name);<br>
       } else {<br>
@@ -795,10 +795,10 @@ nir_split_array_vars(nir_shader *shader, nir_variable_mode modes)<br>
       _mesa_hash_table_create(mem_ctx, _mesa_hash_pointer,<br>
                               _mesa_key_pointer_equal);<br>
<br>
-   assert((modes & (nir_var_global | nir_var_local)) == modes);<br>
+   assert((modes & (nir_var_private | nir_var_function)) == modes);<br>
<br>
    bool has_global_array = false;<br>
-   if (modes & nir_var_global) {<br>
+   if (modes & nir_var_private) {<br>
       has_global_array = init_var_list_array_infos(&shader->globals,<br>
                                                    var_info_map, mem_ctx);<br>
    }<br>
@@ -809,7 +809,7 @@ nir_split_array_vars(nir_shader *shader, nir_variable_mode modes)<br>
          continue;<br>
<br>
       bool has_local_array = false;<br>
-      if (modes & nir_var_local) {<br>
+      if (modes & nir_var_function) {<br>
          has_local_array = init_var_list_array_infos(&function->impl->locals,<br>
                                                      var_info_map, mem_ctx);<br>
       }<br>
@@ -827,7 +827,7 @@ nir_split_array_vars(nir_shader *shader, nir_variable_mode modes)<br>
    }<br>
<br>
    bool has_global_splits = false;<br>
-   if (modes & nir_var_global) {<br>
+   if (modes & nir_var_private) {<br>
       has_global_splits = split_var_list_arrays(shader, NULL,<br>
                                                 &shader->globals,<br>
                                                 var_info_map, mem_ctx);<br>
@@ -839,7 +839,7 @@ nir_split_array_vars(nir_shader *shader, nir_variable_mode modes)<br>
          continue;<br>
<br>
       bool has_local_splits = false;<br>
-      if (modes & nir_var_local) {<br>
+      if (modes & nir_var_function) {<br>
          has_local_splits = split_var_list_arrays(shader, function->impl,<br>
                                                   &function->impl->locals,<br>
                                                   var_info_map, mem_ctx);<br>
@@ -1494,10 +1494,10 @@ function_impl_has_vars_with_modes(nir_function_impl *impl,<br>
 {<br>
    nir_shader *shader = impl->function->shader;<br>
<br>
-   if ((modes & nir_var_global) && !exec_list_is_empty(&shader->globals))<br>
+   if ((modes & nir_var_private) && !exec_list_is_empty(&shader->globals))<br>
       return true;<br>
<br>
-   if ((modes & nir_var_local) && !exec_list_is_empty(&impl->locals))<br>
+   if ((modes & nir_var_function) && !exec_list_is_empty(&impl->locals))<br>
       return true;<br>
<br>
    return false;<br>
@@ -1515,7 +1515,7 @@ function_impl_has_vars_with_modes(nir_function_impl *impl,<br>
 bool<br>
 nir_shrink_vec_array_vars(nir_shader *shader, nir_variable_mode modes)<br>
 {<br>
-   assert((modes & (nir_var_global | nir_var_local)) == modes);<br>
+   assert((modes & (nir_var_private | nir_var_function)) == modes);<br>
<br>
    void *mem_ctx = ralloc_context(NULL);<br>
<br>
@@ -1544,7 +1544,7 @@ nir_shrink_vec_array_vars(nir_shader *shader, nir_variable_mode modes)<br>
    }<br>
<br>
    bool globals_shrunk = false;<br>
-   if (modes & nir_var_global)<br>
+   if (modes & nir_var_private)<br>
       globals_shrunk = shrink_vec_var_list(&shader->globals, var_usage_map);<br>
<br>
    bool progress = false;<br>
@@ -1553,7 +1553,7 @@ nir_shrink_vec_array_vars(nir_shader *shader, nir_variable_mode modes)<br>
          continue;<br>
<br>
       bool locals_shrunk = false;<br>
-      if (modes & nir_var_local) {<br>
+      if (modes & nir_var_function) {<br>
          locals_shrunk = shrink_vec_var_list(&function->impl->locals,<br>
                                              var_usage_map);<br>
       }<br>
diff --git a/src/compiler/nir/nir_validate.c b/src/compiler/nir/nir_validate.c<br>
index 62893cad87e..7ee13da258d 100644<br>
--- a/src/compiler/nir/nir_validate.c<br>
+++ b/src/compiler/nir/nir_validate.c<br>
@@ -397,7 +397,7 @@ validate_var_use(nir_variable *var, validate_state *state)<br>
 {<br>
    struct hash_entry *entry = _mesa_hash_table_search(state->var_defs, var);<br>
    validate_assert(state, entry);<br>
-   if (var->data.mode == nir_var_local)<br>
+   if (var->data.mode == nir_var_function)<br>
       validate_assert(state, (nir_function_impl *) entry->data == state->impl);<br>
 }<br>
<br>
diff --git a/src/compiler/nir/tests/vars_tests.cpp b/src/compiler/nir/tests/vars_tests.cpp<br>
index 32763d2db64..102c47d3f79 100644<br>
--- a/src/compiler/nir/tests/vars_tests.cpp<br>
+++ b/src/compiler/nir/tests/vars_tests.cpp<br>
@@ -34,14 +34,14 @@ protected:<br>
    ~nir_vars_test();<br>
<br>
    nir_variable *create_int(nir_variable_mode mode, const char *name) {<br>
-      if (mode == nir_var_local)<br>
+      if (mode == nir_var_function)<br>
          return nir_local_variable_create(b->impl, glsl_int_type(), name);<br>
       return nir_variable_create(b->shader, mode, glsl_int_type(), name);<br>
    }<br>
<br>
    nir_variable *create_ivec2(nir_variable_mode mode, const char *name) {<br>
       const glsl_type *var_type = glsl_vector_type(GLSL_TYPE_INT, 2);<br>
-      if (mode == nir_var_local)<br>
+      if (mode == nir_var_function)<br>
          return nir_local_variable_create(b->impl, var_type, name);<br>
       return nir_variable_create(b->shader, mode, var_type, name);<br>
    }<br>
@@ -191,7 +191,7 @@ TEST_F(nir_redundant_load_vars_test, invalidate_inside_if_block)<br>
     * if statement.  They should be invalidated accordingly.<br>
     */<br>
<br>
-   nir_variable **g = create_many_int(nir_var_global, "g", 3);<br>
+   nir_variable **g = create_many_int(nir_var_private, "g", 3);<br>
    nir_variable **out = create_many_int(nir_var_shader_out, "out", 3);<br>
<br>
    nir_load_var(b, g[0]);<br>
@@ -259,7 +259,7 @@ TEST_F(nir_redundant_load_vars_test, invalidate_live_load_in_the_end_of_loop)<br>
 TEST_F(nir_copy_prop_vars_test, simple_copies)<br>
 {<br>
    nir_variable *in   = create_int(nir_var_shader_in,  "in");<br>
-   nir_variable *temp = create_int(nir_var_local,      "temp");<br>
+   nir_variable *temp = create_int(nir_var_function,   "temp");<br>
    nir_variable *out  = create_int(nir_var_shader_out, "out");<br>
<br>
    nir_copy_var(b, temp, in);<br>
@@ -284,7 +284,7 @@ TEST_F(nir_copy_prop_vars_test, simple_copies)<br>
<br>
 TEST_F(nir_copy_prop_vars_test, simple_store_load)<br>
 {<br>
-   nir_variable **v = create_many_ivec2(nir_var_local, "v", 2);<br>
+   nir_variable **v = create_many_ivec2(nir_var_function, "v", 2);<br>
    unsigned mask = 1 | 2;<br>
<br>
    nir_ssa_def *stored_value = nir_imm_ivec2(b, 10, 20);<br>
@@ -312,7 +312,7 @@ TEST_F(nir_copy_prop_vars_test, simple_store_load)<br>
<br>
 TEST_F(nir_copy_prop_vars_test, store_store_load)<br>
 {<br>
-   nir_variable **v = create_many_ivec2(nir_var_local, "v", 2);<br>
+   nir_variable **v = create_many_ivec2(nir_var_function, "v", 2);<br>
    unsigned mask = 1 | 2;<br>
<br>
    nir_ssa_def *first_value = nir_imm_ivec2(b, 10, 20);<br>
@@ -345,7 +345,7 @@ TEST_F(nir_copy_prop_vars_test, store_store_load)<br>
<br>
 TEST_F(nir_copy_prop_vars_test, store_store_load_different_components)<br>
 {<br>
-   nir_variable **v = create_many_ivec2(nir_var_local, "v", 2);<br>
+   nir_variable **v = create_many_ivec2(nir_var_function, "v", 2);<br>
<br>
    nir_ssa_def *first_value = nir_imm_ivec2(b, 10, 20);<br>
    nir_store_var(b, v[0], first_value, 1 << 1);<br>
@@ -384,7 +384,7 @@ TEST_F(nir_copy_prop_vars_test, store_store_load_different_components)<br>
<br>
 TEST_F(nir_copy_prop_vars_test, store_store_load_different_components_in_many_blocks)<br>
 {<br>
-   nir_variable **v = create_many_ivec2(nir_var_local, "v", 2);<br>
+   nir_variable **v = create_many_ivec2(nir_var_function, "v", 2);<br>
<br>
    nir_ssa_def *first_value = nir_imm_ivec2(b, 10, 20);<br>
    nir_store_var(b, v[0], first_value, 1 << 1);<br>
@@ -459,7 +459,7 @@ TEST_F(nir_copy_prop_vars_test, memory_barrier_in_two_blocks)<br>
<br>
 TEST_F(nir_copy_prop_vars_test, simple_store_load_in_two_blocks)<br>
 {<br>
-   nir_variable **v = create_many_ivec2(nir_var_local, "v", 2);<br>
+   nir_variable **v = create_many_ivec2(nir_var_function, "v", 2);<br>
    unsigned mask = 1 | 2;<br>
<br>
    nir_ssa_def *stored_value = nir_imm_ivec2(b, 10, 20);<br>
diff --git a/src/compiler/spirv/vtn_cfg.c b/src/compiler/spirv/vtn_cfg.c<br>
index 726f717e8d5..5b3cc703f94 100644<br>
--- a/src/compiler/spirv/vtn_cfg.c<br>
+++ b/src/compiler/spirv/vtn_cfg.c<br>
@@ -876,7 +876,7 @@ vtn_emit_cf_list(struct vtn_builder *b, struct list_head *cf_list,<br>
             struct vtn_ssa_value *src = vtn_ssa_value(b, block->branch[1]);<br>
             nir_deref_instr *ret_deref =<br>
                nir_build_deref_cast(&b->nb, nir_load_param(&b->nb, 0),<br>
-                                    nir_var_local, src->type);<br>
+                                    nir_var_function, src->type);<br>
             vtn_local_store(b, src, ret_deref);<br>
          }<br>
<br>
diff --git a/src/compiler/spirv/vtn_private.h b/src/compiler/spirv/vtn_private.h<br>
index 47f26dac642..b84ac2cf0b4 100644<br>
--- a/src/compiler/spirv/vtn_private.h<br>
+++ b/src/compiler/spirv/vtn_private.h<br>
@@ -411,7 +411,7 @@ struct vtn_access_chain {<br>
<br>
 enum vtn_variable_mode {<br>
    vtn_variable_mode_local,<br>
-   vtn_variable_mode_global,<br>
+   vtn_variable_mode_private,<br>
    vtn_variable_mode_uniform,<br>
    vtn_variable_mode_ubo,<br>
    vtn_variable_mode_ssbo,<br>
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c<br>
index fe44e71800d..b911b114b70 100644<br>
--- a/src/compiler/spirv/vtn_variables.c<br>
+++ b/src/compiler/spirv/vtn_variables.c<br>
@@ -1566,12 +1566,12 @@ vtn_storage_class_to_mode(struct vtn_builder *b,<br>
       nir_mode = nir_var_shader_out;<br>
       break;<br>
    case SpvStorageClassPrivate:<br>
-      mode = vtn_variable_mode_global;<br>
-      nir_mode = nir_var_global;<br>
+      mode = vtn_variable_mode_private;<br>
+      nir_mode = nir_var_private;<br>
       break;<br>
    case SpvStorageClassFunction:<br>
       mode = vtn_variable_mode_local;<br>
-      nir_mode = nir_var_local;<br>
+      nir_mode = nir_var_function;<br>
       break;<br>
    case SpvStorageClassWorkgroup:<br>
       mode = vtn_variable_mode_workgroup;<br>
@@ -1732,7 +1732,7 @@ vtn_create_variable(struct vtn_builder *b, struct vtn_value *val,<br>
<br>
    switch (var->mode) {<br>
    case vtn_variable_mode_local:<br>
-   case vtn_variable_mode_global:<br>
+   case vtn_variable_mode_private:<br>
    case vtn_variable_mode_uniform:<br>
       /* For these, we create the variable normally */<br>
       var->var = rzalloc(b->shader, nir_variable);<br>
diff --git a/src/freedreno/ir3/ir3_nir.c b/src/freedreno/ir3/ir3_nir.c<br>
index 70c01ee0593..6a3830020d2 100644<br>
--- a/src/freedreno/ir3/ir3_nir.c<br>
+++ b/src/freedreno/ir3/ir3_nir.c<br>
@@ -194,7 +194,7 @@ ir3_optimize_nir(struct ir3_shader *shader, nir_shader *s,<br>
        if (OPT(s, nir_lower_idiv))<br>
                ir3_optimize_loop(s);<br>
<br>
-       OPT_V(s, nir_remove_dead_variables, nir_var_local);<br>
+       OPT_V(s, nir_remove_dead_variables, nir_var_function);<br>
<br>
        OPT_V(s, nir_move_load_const);<br>
<br>
diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c b/src/gallium/auxiliary/nir/tgsi_to_nir.c<br>
index 0ad274b535a..f0bcce0feb3 100644<br>
--- a/src/gallium/auxiliary/nir/tgsi_to_nir.c<br>
+++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c<br>
@@ -182,7 +182,7 @@ ttn_emit_declaration(struct ttn_compile *c)<br>
          nir_variable *var = rzalloc(b->shader, nir_variable);<br>
<br>
          var->type = glsl_array_type(glsl_vec4_type(), array_size);<br>
-         var->data.mode = nir_var_global;<br>
+         var->data.mode = nir_var_private;<br>
          var->name = ralloc_asprintf(var, "arr_%d", decl->Array.ArrayID);<br>
<br>
          exec_list_push_tail(&b->shader->globals, &var->node);<br>
diff --git a/src/gallium/drivers/v3d/v3d_program.c b/src/gallium/drivers/v3d/v3d_program.c<br>
index 1dceade950a..7a9067bfc50 100644<br>
--- a/src/gallium/drivers/v3d/v3d_program.c<br>
+++ b/src/gallium/drivers/v3d/v3d_program.c<br>
@@ -225,7 +225,7 @@ v3d_shader_state_create(struct pipe_context *pctx,<br>
<br>
         v3d_optimize_nir(s);<br>
<br>
-        NIR_PASS_V(s, nir_remove_dead_variables, nir_var_local);<br>
+        NIR_PASS_V(s, nir_remove_dead_variables, nir_var_function);<br>
<br>
         /* Garbage collect dead instructions */<br>
         nir_sweep(s);<br>
diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c<br>
index b98baca30cf..143fc2849ec 100644<br>
--- a/src/gallium/drivers/vc4/vc4_program.c<br>
+++ b/src/gallium/drivers/vc4/vc4_program.c<br>
@@ -1598,7 +1598,7 @@ vc4_optimize_nir(struct nir_shader *s)<br>
                 NIR_PASS(progress, s, nir_opt_loop_unroll,<br>
                          nir_var_shader_in |<br>
                          nir_var_shader_out |<br>
-                         nir_var_local);<br>
+                         nir_var_function);<br>
         } while (progress);<br>
 }<br>
<br>
@@ -2515,7 +2515,7 @@ vc4_shader_state_create(struct pipe_context *pctx,<br>
<br>
         vc4_optimize_nir(s);<br>
<br>
-        NIR_PASS_V(s, nir_remove_dead_variables, nir_var_local);<br>
+        NIR_PASS_V(s, nir_remove_dead_variables, nir_var_function);<br>
<br>
         /* Garbage collect dead instructions */<br>
         nir_sweep(s);<br>
diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c<br>
index aa6788b9fe5..5dbcfefa829 100644<br>
--- a/src/intel/compiler/brw_nir.c<br>
+++ b/src/intel/compiler/brw_nir.c<br>
@@ -527,7 +527,7 @@ brw_nir_no_indirect_mask(const struct brw_compiler *compiler,<br>
    if (compiler->glsl_compiler_options[stage].EmitNoIndirectOutput)<br>
       indirect_mask |= nir_var_shader_out;<br>
    if (compiler->glsl_compiler_options[stage].EmitNoIndirectTemp)<br>
-      indirect_mask |= nir_var_local;<br>
+      indirect_mask |= nir_var_function;<br>
<br>
    return indirect_mask;<br>
 }<br>
@@ -542,8 +542,8 @@ brw_nir_optimize(nir_shader *nir, const struct brw_compiler *compiler,<br>
    bool progress;<br>
    do {<br>
       progress = false;<br>
-      OPT(nir_split_array_vars, nir_var_local);<br>
-      OPT(nir_shrink_vec_array_vars, nir_var_local);<br>
+      OPT(nir_split_array_vars, nir_var_function);<br>
+      OPT(nir_shrink_vec_array_vars, nir_var_function);<br>
       OPT(nir_lower_vars_to_ssa);<br>
       if (allow_copies) {<br>
          /* Only run this pass in the first call to brw_nir_optimize.  Later<br>
@@ -602,7 +602,7 @@ brw_nir_optimize(nir_shader *nir, const struct brw_compiler *compiler,<br>
    /* Workaround Gfxbench unused local sampler variable which will trigger an<br>
     * assert in the opt_large_constants pass.<br>
     */<br>
-   OPT(nir_remove_dead_variables, nir_var_local);<br>
+   OPT(nir_remove_dead_variables, nir_var_function);<br>
<br>
    return nir;<br>
 }<br>
@@ -664,7 +664,7 @@ brw_preprocess_nir(const struct brw_compiler *compiler, nir_shader *nir)<br>
    OPT(nir_lower_global_vars_to_local);<br>
<br>
    OPT(nir_split_var_copies);<br>
-   OPT(nir_split_struct_vars, nir_var_local);<br>
+   OPT(nir_split_struct_vars, nir_var_function);<br>
<br>
    /* Run opt_algebraic before int64 lowering so we can hopefully get rid<br>
     * of some int64 instructions.<br>
diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c<br>
index ee37685fccf..cd4eccccc9c 100644<br>
--- a/src/intel/vulkan/anv_pipeline.c<br>
+++ b/src/intel/vulkan/anv_pipeline.c<br>
@@ -180,7 +180,7 @@ anv_shader_compile_to_nir(struct anv_pipeline *pipeline,<br>
     * inline functions.  That way they get properly initialized at the top<br>
     * of the function and not at the top of its caller.<br>
     */<br>
-   NIR_PASS_V(nir, nir_lower_constant_initializers, nir_var_local);<br>
+   NIR_PASS_V(nir, nir_lower_constant_initializers, nir_var_function);<br>
    NIR_PASS_V(nir, nir_lower_returns);<br>
    NIR_PASS_V(nir, nir_inline_functions);<br>
    NIR_PASS_V(nir, nir_copy_prop);<br>
@@ -780,7 +780,7 @@ anv_pipeline_link_fs(const struct brw_compiler *compiler,<br>
           !(stage->key.wm.color_outputs_valid & (1 << rt))) {<br>
          /* Unused or out-of-bounds, throw it away */<br>
          deleted_output = true;<br>
-         var->data.mode = nir_var_local;<br>
+         var->data.mode = nir_var_function;<br>
          exec_node_remove(&var->node);<br>
          exec_list_push_tail(&impl->locals, &var->node);<br>
          continue;<br>
diff --git a/src/mesa/main/glspirv.c b/src/mesa/main/glspirv.c<br>
index 04e46ba571e..06a964b7306 100644<br>
--- a/src/mesa/main/glspirv.c<br>
+++ b/src/mesa/main/glspirv.c<br>
@@ -242,7 +242,7 @@ _mesa_spirv_to_nir(struct gl_context *ctx,<br>
     * inline functions.  That way they get properly initialized at the top<br>
     * of the function and not at the top of its caller.<br>
     */<br>
-   NIR_PASS_V(nir, nir_lower_constant_initializers, nir_var_local);<br>
+   NIR_PASS_V(nir, nir_lower_constant_initializers, nir_var_function);<br>
    NIR_PASS_V(nir, nir_lower_returns);<br>
    NIR_PASS_V(nir, nir_inline_functions);<br>
    NIR_PASS_V(nir, nir_copy_prop);<br>
diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp<br>
index d0475fb538a..5ea1986103e 100644<br>
--- a/src/mesa/state_tracker/st_glsl_to_nir.cpp<br>
+++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp<br>
@@ -103,7 +103,7 @@ st_nir_assign_vs_in_locations(struct gl_program *prog, nir_shader *nir)<br>
           * set.<br>
           */<br>
          exec_node_remove(&var->node);<br>
-         var->data.mode = nir_var_global;<br>
+         var->data.mode = nir_var_private;<br>
          exec_list_push_tail(&nir->globals, &var->node);<br>
       }<br>
    }<br>
@@ -609,7 +609,7 @@ st_nir_link_shaders(nir_shader **producer, nir_shader **consumer, bool scalar)<br>
        * See the following thread for more details of the problem:<br>
        * <a href="https://lists.freedesktop.org/archives/mesa-dev/2017-July/162106.html" rel="noreferrer" target="_blank">https://lists.freedesktop.org/archives/mesa-dev/2017-July/162106.html</a><br>
        */<br>
-      nir_variable_mode indirect_mask = nir_var_local;<br>
+      nir_variable_mode indirect_mask = nir_var_function;<br>
<br>
       NIR_PASS_V(*producer, nir_lower_indirect_derefs, indirect_mask);<br>
       NIR_PASS_V(*consumer, nir_lower_indirect_derefs, indirect_mask);<br>
-- <br>
2.19.2<br>
<br>
</blockquote></div>