Mesa (master): nir/loop_unroll: Fix out-of-bounds access handling
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Mar 13 02:07:24 UTC 2019
Module: Mesa
Branch: master
Commit: 83fdefc06287f6c8bbb3bb5bb4ccd36d653017a3
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=83fdefc06287f6c8bbb3bb5bb4ccd36d653017a3
Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date: Tue Mar 12 16:25:39 2019 -0500
nir/loop_unroll: Fix out-of-bounds access handling
The previous code was completely broken when it came to constructing the
undef values. I'm not sure how it ever worked. For the case of a copy
that reads an undefined value, we can just delete the copy because the
destination is a valid undefined value. This saves us the effort of
trying to construct a value for an arbitrary copy_deref intrinsic.
Fixes: e8a8937a04 "nir: add partial loop unrolling support"
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
---
src/compiler/nir/nir_opt_loop_unroll.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/src/compiler/nir/nir_opt_loop_unroll.c b/src/compiler/nir/nir_opt_loop_unroll.c
index 06ec78b8068..b2696d4aadb 100644
--- a/src/compiler/nir/nir_opt_loop_unroll.c
+++ b/src/compiler/nir/nir_opt_loop_unroll.c
@@ -670,11 +670,9 @@ remove_out_of_bounds_induction_use(nir_shader *shader, nir_loop *loop,
if (is_access_out_of_bounds(term, nir_src_as_deref(intrin->src[0]),
trip_count)) {
if (intrin->intrinsic == nir_intrinsic_load_deref) {
- assert(intrin->src[0].is_ssa);
- nir_ssa_def *a_ssa = intrin->src[0].ssa;
nir_ssa_def *undef =
- nir_ssa_undef(&b, intrin->num_components,
- a_ssa->bit_size);
+ nir_ssa_undef(&b, intrin->dest.ssa.num_components,
+ intrin->dest.ssa.bit_size);
nir_ssa_def_rewrite_uses(&intrin->dest.ssa,
nir_src_for_ssa(undef));
} else {
@@ -686,14 +684,6 @@ remove_out_of_bounds_induction_use(nir_shader *shader, nir_loop *loop,
if (intrin->intrinsic == nir_intrinsic_copy_deref &&
is_access_out_of_bounds(term, nir_src_as_deref(intrin->src[1]),
trip_count)) {
- assert(intrin->src[1].is_ssa);
- nir_ssa_def *a_ssa = intrin->src[1].ssa;
- nir_ssa_def *undef =
- nir_ssa_undef(&b, intrin->num_components, a_ssa->bit_size);
-
- /* Replace the copy with a store of the undefined value */
- b.cursor = nir_before_instr(instr);
- nir_store_deref(&b, nir_src_as_deref(intrin->src[0]), undef, ~0);
nir_instr_remove(instr);
}
}
More information about the mesa-commit
mailing list