Mesa (staging/20.2): gallivm: zero init the temporary register storage.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Nov 2 16:09:39 UTC 2020


Module: Mesa
Branch: staging/20.2
Commit: f401af6f1863df34df7c823403d9646a17720a5a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f401af6f1863df34df7c823403d9646a17720a5a

Author: Dave Airlie <airlied at redhat.com>
Date:   Thu Oct 29 13:06:43 2020 +1000

gallivm: zero init the temporary register storage.

Due to flow control we can end up with random values in here having
side effects.

This fixes a crash in gtk4-demo.

Fixes: 44a6b0107b37 ("gallivm: add nir->llvm translation (v2)")
Reviewed-by: Roland Scheidegger <sroland at vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7327>
(cherry picked from commit f7d1460418f11c0209d099ddc552d126a68ba6e4)

---

 .pick_status.json                          | 2 +-
 src/gallium/auxiliary/gallivm/lp_bld_nir.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 47e80221792..f1c05714c98 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -769,7 +769,7 @@
         "description": "gallivm: zero init the temporary register storage.",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "44a6b0107b37ad9644d3435cf6d2d29b6779654f"
     },
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_nir.c b/src/gallium/auxiliary/gallivm/lp_bld_nir.c
index e21c2c35de0..7341d72a440 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_nir.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_nir.c
@@ -1976,8 +1976,8 @@ bool lp_build_nir_llvm(
 
    nir_foreach_register(reg, &func->impl->registers) {
       LLVMTypeRef type = get_register_type(bld_base, reg);
-      LLVMValueRef reg_alloc = lp_build_alloca_undef(bld_base->base.gallivm,
-                                                     type, "reg");
+      LLVMValueRef reg_alloc = lp_build_alloca(bld_base->base.gallivm,
+                                               type, "reg");
       _mesa_hash_table_insert(bld_base->regs, reg, reg_alloc);
    }
    nir_index_ssa_defs(func->impl);



More information about the mesa-commit mailing list