From: Ian Romanick <ian.d.roman...@intel.com> I don't understand why the old code was bad, but the new code is fine.
brw_state_dump.c: In function ‘brw_debug_batch’: brw_state_dump.c:677:4: warning: cannot optimize loop, the loop counter may overflow [-Wunsafe-loop-optimizations] for (i = 0; i < size / 4; i += 4) { ^ brw_state_dump.c:693:4: warning: cannot optimize loop, the loop counter may overflow [-Wunsafe-loop-optimizations] for (i = 0; i < size / 4; i += 4) { ^ Signed-off-by: Ian Romanick <ian.d.roman...@intel.com> --- src/mesa/drivers/dri/i965/brw_state_dump.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_state_dump.c b/src/mesa/drivers/dri/i965/brw_state_dump.c index 943b2a9..ba09537 100644 --- a/src/mesa/drivers/dri/i965/brw_state_dump.c +++ b/src/mesa/drivers/dri/i965/brw_state_dump.c @@ -674,7 +674,9 @@ dump_vs_constants(struct brw_context *brw, uint32_t offset, uint32_t size) uint32_t *as_uint = brw->batch.bo->virtual + offset; float *as_float = brw->batch.bo->virtual + offset; - for (unsigned i = 0; i < size / 4; i += 4) { + for (unsigned j = 0; j < size / 16; j++) { + const unsigned i = j * 4; + batch_out(brw, name, offset, i, "%3d: (% f % f % f % f) (0x%08x 0x%08x 0x%08x 0x%08x)\n", i / 4, as_float[i], as_float[i + 1], as_float[i + 2], as_float[i + 3], @@ -689,7 +691,9 @@ dump_wm_constants(struct brw_context *brw, uint32_t offset, uint32_t size) uint32_t *as_uint = brw->batch.bo->virtual + offset; float *as_float = brw->batch.bo->virtual + offset; - for (unsigned i = 0; i < size / 4; i += 4) { + for (unsigned j = 0; j < size / 16; j++) { + const unsigned i = j * 4; + batch_out(brw, name, offset, i, "%3d: (% f % f % f % f) (0x%08x 0x%08x 0x%08x 0x%08x)\n", i / 4, as_float[i], as_float[i + 1], as_float[i + 2], as_float[i + 3], -- 2.5.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev