From a7cb592efa9ec72c4c5e9d3c1e7469203a4b47e2 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Tue, 2 Apr 2024 15:15:04 +0300 Subject: add simple unreachability --- src/asm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/asm.c') diff --git a/src/asm.c b/src/asm.c index eb0bead..e177c4e 100644 --- a/src/asm.c +++ b/src/asm.c @@ -240,10 +240,10 @@ static void output_ret(struct fn *f, FILE *o) static void output_j(struct blk *b, struct fn *f, FILE *o) { /* the jump is directly to a following block, no need to do anything */ - if (!b->to) + if (!b->to || b->s1 == b->s2) return; - fprintf(o, "j .%s.%lli\n", f->name, (long long int)b->s1->id); + fprintf(o, "j .%s.%lli\n", f->name, (long long int)b->s2->id); } static void output_branch(struct blk *b, struct fn *f, FILE *o) -- cgit v1.3