aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-11-12 22:09:35 +0100
committerlemon <lsof@mailbox.org>2025-11-12 22:09:35 +0100
commitfc91a4ce139fd0236ad9e8c4fe1e7dad42f0b178 (patch)
tree16c5290173b93239e390a8946ea56c4e507a6ddc
parent891edf7ba1582d1f6254c59a246db577f14b864a (diff)
mem2reg: handle uses in branches in cmpuse()
-rw-r--r--ir/optmem.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/ir/optmem.c b/ir/optmem.c
index df0cabf..f70a281 100644
--- a/ir/optmem.c
+++ b/ir/optmem.c
@@ -196,6 +196,8 @@ cmpuse(const void *a, const void *b)
const struct use *ua = a, *ub = b;
struct block *blk = ua->blk;
if (ua->blk != ub->blk) return ua->blk->id - ub->blk->id;
+ if (ua->u == USERJUMP) return ub->u != USERJUMP;
+ if (ub->u == USERJUMP) return -(ua->u != USERJUMP);
return blkfindins(blk, ua->u) - blkfindins(blk, ub->u);
}