nir: gather info whether a shader uses demote_to_helper

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4047>
diff --git a/src/compiler/nir/nir_gather_info.c b/src/compiler/nir/nir_gather_info.c
index 0a89c4b..c301742 100644
--- a/src/compiler/nir/nir_gather_info.c
+++ b/src/compiler/nir/nir_gather_info.c
@@ -200,6 +200,8 @@
    switch (instr->intrinsic) {
    case nir_intrinsic_demote:
    case nir_intrinsic_demote_if:
+      shader->info.fs.uses_demote = true;
+   /* fallthrough: quads with helper lanes only might be discarded entirely */
    case nir_intrinsic_discard:
    case nir_intrinsic_discard_if:
       assert(shader->info.stage == MESA_SHADER_FRAGMENT);
@@ -389,6 +391,7 @@
    if (shader->info.stage == MESA_SHADER_FRAGMENT) {
       shader->info.fs.uses_sample_qualifier = false;
       shader->info.fs.uses_discard = false;
+      shader->info.fs.uses_demote = false;
       shader->info.fs.needs_helper_invocations = false;
    }
 
diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h
index d13e51a..4510ce3 100644
--- a/src/compiler/shader_info.h
+++ b/src/compiler/shader_info.h
@@ -217,6 +217,7 @@
 
       struct {
          bool uses_discard:1;
+         bool uses_demote:1;
 
          /**
           * True if this fragment shader requires helper invocations.  This