OSDN Git Service

nir/loop_analyze: Handle bit sizes correctly in calculate_iterations
authorJason Ekstrand <jason@jlekstrand.net>
Thu, 20 Jun 2019 21:26:19 +0000 (16:26 -0500)
committerJason Ekstrand <jason@jlekstrand.net>
Wed, 10 Jul 2019 00:20:59 +0000 (00:20 +0000)
commit268ad47c1115be8a8444d8e0e40af71623f9d281
tree9b5ca73c0508f1e38b8dd8d29fffc460bd6fe2d2
parent9f7ffe41dd185487479ea8846df1f5cdbf1b83a6
nir/loop_analyze: Handle bit sizes correctly in calculate_iterations

The current code assumes everything is 32-bit which is very likely true
but not guaranteed by any means.  Instead, use nir_eval_const_opcode to
do the calculations in a bit-size-agnostic way.  We also use the new
constant constructors to build the correct size constants.

Fixes: 6772a17acc8ee "nir: Add a loop analysis pass"
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/compiler/nir/nir_loop_analyze.c