Mesa (main): nir/algebraic: Drop the check for cache == None.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Dec 7 07:49:39 UTC 2021


Module: Mesa
Branch: main
Commit: e7d871737598483777e967db59fe7abaa9023d46
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e7d871737598483777e967db59fe7abaa9023d46

Author: Emma Anholt <emma at anholt.net>
Date:   Mon Nov 29 14:14:35 2021 -0800

nir/algebraic: Drop the check for cache == None.

The cache is always set.

Reviewed-by: Adam Jackson <ajax at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13987>

---

 src/compiler/nir/nir_algebraic.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/compiler/nir/nir_algebraic.py b/src/compiler/nir/nir_algebraic.py
index 3f48ff92a80..1b73fc019b7 100644
--- a/src/compiler/nir/nir_algebraic.py
+++ b/src/compiler/nir/nir_algebraic.py
@@ -153,7 +153,7 @@ class Value(object):
       return "nir_search_" + self.type_str
 
    def __c_name(self, cache):
-      if cache is not None and self.name in cache:
+      if self.name in cache:
          return cache[self.name]
       else:
          return self.name
@@ -203,15 +203,14 @@ class Value(object):
                                            Constant=Constant,
                                            Variable=Variable,
                                            Expression=Expression)
-      if cache is not None and struct_init in cache:
+      if struct_init in cache:
          # If it's in the cache, register a name remap in the cache and render
          # only a comment saying it's been remapped
          cache[self.name] = cache[struct_init]
          return "/* {} -> {} in the cache */\n".format(self.name,
                                                        cache[struct_init])
       else:
-         if cache is not None:
-            cache[struct_init] = self.name
+         cache[struct_init] = self.name
          return "static const {} {} = {}\n".format(self.c_type, self.name,
                                                    struct_init)
 



More information about the mesa-commit mailing list