pan/bi: Range check newc/oldc when rewriting

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Suggested-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7081>
diff --git a/src/panfrost/bifrost/bir.c b/src/panfrost/bifrost/bir.c
index 548594a..989298e 100644
--- a/src/panfrost/bifrost/bir.c
+++ b/src/panfrost/bifrost/bir.c
@@ -190,6 +190,8 @@
                 unsigned old, unsigned oldc,
                 unsigned new, unsigned newc)
 {
+        assert(newc >= oldc);
+
         bi_foreach_instr_global(ctx, ins) {
                 bi_foreach_src(ins, s) {
                         if (ins->src[s] != old) continue;