Mesa (master): nir/opt_access: don't check restrict in can_reorder()

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Dec 9 14:58:42 UTC 2020


Module: Mesa
Branch: master
Commit: 939df4e364cb8474d79dd8107db24a30cb537027
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=939df4e364cb8474d79dd8107db24a30cb537027

Author: Rhys Perry <pendingchaos02 at gmail.com>
Date:   Tue Dec  1 14:38:32 2020 +0000

nir/opt_access: don't check restrict in can_reorder()

ACCESS_NON_WRITEABLE means that the memory is read-only, not the variable,
so we don't have to check for aliasing.

Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6483>

---

 src/compiler/nir/nir_opt_access.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/compiler/nir/nir_opt_access.c b/src/compiler/nir/nir_opt_access.c
index 2dc2e6e9188..d1701686ddc 100644
--- a/src/compiler/nir/nir_opt_access.c
+++ b/src/compiler/nir/nir_opt_access.c
@@ -27,9 +27,8 @@
  *
  * - Infer readonly when it's missing.
  * - Infer ACCESS_CAN_REORDER when the following are true:
- *   - Either there are no writes, or ACCESS_NON_WRITEABLE and ACCESS_RESTRICT
- *     are both set. In either case there are no writes to the underlying
- *     memory.
+ *   - Either there are no writes, or ACCESS_NON_WRITEABLE is set. In either
+ *     case there are no writes to the underlying memory.
  *   - ACCESS_VOLATILE is not set.
  *
  * If these conditions are true, then image and buffer reads may be treated as
@@ -160,11 +159,8 @@ can_reorder(struct access_state *state, enum gl_access_qualifier access,
       state->images_written;
 
    /* Can we guarantee that the underlying memory is never written? */
-   if (!is_any_written ||
-       ((access & ACCESS_NON_WRITEABLE) &&
-        (access & ACCESS_RESTRICT))) {
+   if (!is_any_written || (access & ACCESS_NON_WRITEABLE))
       return !(access & ACCESS_VOLATILE);
-   }
 
    return false;
 }



More information about the mesa-commit mailing list