Mesa (staging/20.0): nir/search: Use larger type to hold linearized index
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Feb 20 21:35:52 UTC 2020
Module: Mesa
Branch: staging/20.0
Commit: 760b8cfd1c3afd483eea30383a2cc7593f7640dd
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=760b8cfd1c3afd483eea30383a2cc7593f7640dd
Author: Ian Romanick <ian.d.romanick at intel.com>
Date: Tue Feb 18 15:31:37 2020 -0800
nir/search: Use larger type to hold linearized index
"index" is an offset into a linearized 3-dimensional array. Starting
with fbd5359a0a6, the 3-dimensional array can have 43 elements in each
dimension. 43**3 = 79507, and that will overflow the uint16_t.
See also the discussion in MR !3765.
Fixes: fbd5359a0a6 ("nir/algebraic: Rearrange bcsel sequences generated by nir_opt_peephole_select")
Suggested-by: Connor Abbott <cwabbott0 at gmail.com>
Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3871>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3871>
(cherry picked from commit 58bdc1c748f2922b3970c3b3a41d1b0977f07886)
---
.pick_status.json | 2 +-
src/compiler/nir/nir_search.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index 36c0c588f09..b6e26b8bb63 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -157,7 +157,7 @@
"description": "nir/search: Use larger type to hold linearized index",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": "fbd5359a0a6f4b6d220c4cea9020ec4665ed4955"
},
diff --git a/src/compiler/nir/nir_search.c b/src/compiler/nir/nir_search.c
index 458a4eeb1ce..7abb023faf5 100644
--- a/src/compiler/nir/nir_search.c
+++ b/src/compiler/nir/nir_search.c
@@ -789,7 +789,7 @@ nir_algebraic_automaton(nir_instr *instr, struct util_dynarray *states,
* itertools.product(), which was used to emit the transition
* table.
*/
- uint16_t index = 0;
+ unsigned index = 0;
for (unsigned i = 0; i < nir_op_infos[op].num_inputs; i++) {
index *= tbl->num_filtered_states;
index += tbl->filter[*util_dynarray_element(states, uint16_t,
More information about the mesa-commit
mailing list