From f63ea1a1303dcd25adb115eb695c6198e4606e19 Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Fri, 13 Oct 2023 19:56:24 +0100 Subject: [PATCH] nir/loop_analyze: skip if basis/limit/comparison is vector Replacement in try_eval_const_alu() doesn't work because the replacements are always scalar. The callers also always give a scalar dest. This is encountered when compiling a Redout shader under ASan. Signed-off-by: Rhys Perry Acked-by: Timothy Arceri Fixes: bc170e895f38 ("nir/loop_analyze: Use try_eval_const_alu and induction variable basis info") Part-of: (cherry picked from commit 796058841378c4d5e04ff8b5cbe5adef5aae326a) --- .pick_status.json | 2 +- src/compiler/nir/nir_loop_analyze.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index e5bb7c2000c..4e85130d7ef 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2154,7 +2154,7 @@ "description": "nir/loop_analyze: skip if basis/limit/comparison is vector", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "bc170e895f384acf24c849798fcff092db440135", "notes": null diff --git a/src/compiler/nir/nir_loop_analyze.c b/src/compiler/nir/nir_loop_analyze.c index 4c39de9d949..f468d2316e5 100644 --- a/src/compiler/nir/nir_loop_analyze.c +++ b/src/compiler/nir/nir_loop_analyze.c @@ -1050,6 +1050,10 @@ calculate_iterations(nir_def *basis, nir_def *limit_basis, induction_base_type); } + if (cond.def->num_components != 1 || basis->num_components != 1 || + limit_basis->num_components != 1) + return -1; + /* do-while loops can increment the starting value before the condition is * checked. e.g. *