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: 44a6b0107b ("gallivm: add nir->llvm translation (v2)")
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7327>
(cherry picked from commit f7d1460418)
This commit is contained in:
Dave Airlie 2020-10-29 13:06:43 +10:00 committed by Dylan Baker
parent 3e2245c454
commit f401af6f18
2 changed files with 3 additions and 3 deletions

View file

@ -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"
},

View file

@ -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);