nir/loop_analyze: Add a function to evaluate an ALU as constant
authorIan Romanick <ian.d.romanick@intel.com>
Tue, 14 Feb 2023 01:23:14 +0000 (17:23 -0800)
committerMarge Bot <emma+marge@anholt.net>
Thu, 6 Apr 2023 23:50:27 +0000 (23:50 +0000)
commit30879a760c98cf9b9b5778306640a8c3491cc40f
treebeef6afaaa10504ac48cf5651e0bd4147d10a5bb
parent2e942909c84df47e661309886c6eeb48a02ec202
nir/loop_analyze: Add a function to evaluate an ALU as constant

...with a substitution. This function is largely a copy-and-paste of
try_fold_alu (nir_opt_constant_folding.c), and an argument could be made
that this function belongs in that file.

v2: Some changes were mistakenly squashed in to "nir/loop_analyze: Use
try_eval_const_alu and induction variable basis info" that should have
been here.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3445>
src/compiler/nir/nir_loop_analyze.c