summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRhys Perry <pendingchaos02@gmail.com>2023-07-03 18:36:28 +0100
committerEric Engestrom <eric@engestrom.ch>2023-07-18 22:44:11 +0100
commitbb78bfed46a66dc0efd51de739efad761fb2c584 (patch)
treef7c055b6ae194b00355eb9077e54ed47ded97535
parent7910039e513930bb57ddb0d1fb4a8dead309019d (diff)
downloadmesa-bb78bfed46a66dc0efd51de739efad761fb2c584.tar.gz
mesa-bb78bfed46a66dc0efd51de739efad761fb2c584.tar.bz2
mesa-bb78bfed46a66dc0efd51de739efad761fb2c584.zip
nir/unsigned_upper_bound: fix phi(bcsel)
This was looking at the wrong sources. src0 is the condition. Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com> Fixes: 72ac3f60261 ("nir: add nir_unsigned_upper_bound and nir_addition_might_overflow") Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23990> (cherry picked from commit 1139d870f38e7458155c192e1b5a3fe322a7c63c)
-rw-r--r--.pick_status.json2
-rw-r--r--src/compiler/nir/nir_range_analysis.c6
2 files changed, 4 insertions, 4 deletions
diff --git a/.pick_status.json b/.pick_status.json
index 5abee8cd430..1e7fa931308 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -436,7 +436,7 @@
"description": "nir/unsigned_upper_bound: fix phi(bcsel)",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": "72ac3f60261a8510512861b93e843e695331e2ab"
},
diff --git a/src/compiler/nir/nir_range_analysis.c b/src/compiler/nir/nir_range_analysis.c
index c85530e1388..927eb6c0e56 100644
--- a/src/compiler/nir/nir_range_analysis.c
+++ b/src/compiler/nir/nir_range_analysis.c
@@ -1418,12 +1418,12 @@ search_phi_bcsel(nir_ssa_scalar scalar, nir_ssa_scalar *buf, unsigned buf_size,
nir_op op = nir_ssa_scalar_alu_op(scalar);
if ((op == nir_op_bcsel || op == nir_op_b32csel) && buf_size >= 2) {
- nir_ssa_scalar src0 = nir_ssa_scalar_chase_alu_src(scalar, 0);
nir_ssa_scalar src1 = nir_ssa_scalar_chase_alu_src(scalar, 1);
+ nir_ssa_scalar src2 = nir_ssa_scalar_chase_alu_src(scalar, 2);
- unsigned added = search_phi_bcsel(src0, buf, buf_size - 1, visited);
+ unsigned added = search_phi_bcsel(src1, buf, buf_size - 1, visited);
buf_size -= added;
- added += search_phi_bcsel(src1, buf + added, buf_size, visited);
+ added += search_phi_bcsel(src2, buf + added, buf_size, visited);
return added;
}
}