summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2022-02-12 02:27:48 -0800
committerQuentin Carbonneaux <quentin@c9x.me>2022-02-17 22:35:22 +0100
commit2cba9f6871fe92e06d5e6433f8e15d2712fa9d52 (patch)
treea824f1430b0151151c399a5810ff225d21d12076
parent3b75357e2bd14d6222bd9e3fb8b6894239ff2ae3 (diff)
downloadroux-2cba9f6871fe92e06d5e6433f8e15d2712fa9d52.tar.gz
cfg: remove unnecessary check for jump type
This condition should match any jump with two successors. This is
needed on riscv64, where there is no flags register, so Jjnz is
used all the way to emit().
-rw-r--r--cfg.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/cfg.c b/cfg.c
index 81da842..36e6427 100644
--- a/cfg.c
+++ b/cfg.c
@@ -298,7 +298,6 @@ simpljmp(Fn *fn)
 
 	Blk **uf; /* union-find */
 	Blk **p, *b, *ret;
-	int c;
 
 	ret = blknew();
 	ret->id = fn->nblk++;
@@ -322,9 +321,7 @@ simpljmp(Fn *fn)
 			uffind(&b->s1, uf);
 		if (b->s2)
 			uffind(&b->s2, uf);
-		c = b->jmp.type - Jjf;
-		if (0 <= c && c <= NCmp)
-		if (b->s1 == b->s2) {
+		if (b->s1 && b->s1 == b->s2) {
 			b->jmp.type = Jjmp;
 			b->s2 = 0;
 		}