Mesa (main): nir/opt_offsets: fix try_extract_const_addition recursion
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Dec 3 12:45:50 UTC 2021
Module: Mesa
Branch: main
Commit: 5c0fe1107291939cfc14baadb49d21045dd90f6d
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5c0fe1107291939cfc14baadb49d21045dd90f6d
Author: Rhys Perry <pendingchaos02 at gmail.com>
Date: Thu Dec 2 13:14:22 2021 +0000
nir/opt_offsets: fix try_extract_const_addition recursion
This initially looks like a miscompilation bug, but I don't think it's
actually possible for it to create incorrect code.
fossil-db (Sienna Cichlid):
Totals from 32 (0.02% of 134572) affected shaders:
VGPRs: 1336 -> 1320 (-1.20%)
CodeSize: 90552 -> 89468 (-1.20%)
Instrs: 17007 -> 16852 (-0.91%); split: -0.92%, +0.01%
Latency: 429040 -> 428136 (-0.21%); split: -0.21%, +0.00%
InvThroughput: 84966 -> 84572 (-0.46%); split: -0.47%, +0.00%
Copies: 1458 -> 1468 (+0.69%); split: -0.07%, +0.75%
Branches: 382 -> 384 (+0.52%)
PreSGPRs: 970 -> 968 (-0.21%)
PreVGPRs: 1029 -> 1011 (-1.75%)
Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Emma Anholt <emma at anholt.net>
Reviewed-by: Timur Kristóf <timur.kristof at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14009>
---
src/compiler/nir/nir_opt_offsets.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/compiler/nir/nir_opt_offsets.c b/src/compiler/nir/nir_opt_offsets.c
index 88b7b2a2862..9e1ae252897 100644
--- a/src/compiler/nir/nir_opt_offsets.c
+++ b/src/compiler/nir/nir_opt_offsets.c
@@ -70,7 +70,7 @@ try_extract_const_addition(nir_builder *b, nir_instr *instr, opt_offsets_state *
return alu->src[1 - i].src.ssa;
}
- nir_ssa_def *replace_src = try_extract_const_addition(b, alu->src[0].src.ssa->parent_instr, state, out_const);
+ nir_ssa_def *replace_src = try_extract_const_addition(b, alu->src[i].src.ssa->parent_instr, state, out_const);
if (replace_src) {
b->cursor = nir_before_instr(&alu->instr);
return nir_iadd(b, replace_src, alu->src[1 - i].src.ssa);
More information about the mesa-commit
mailing list