aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--ir/regalloc.c1
-rw-r--r--x86_64/emit.c2
2 files changed, 3 insertions, 0 deletions
diff --git a/ir/regalloc.c b/ir/regalloc.c
index 14dfafc..9057d43 100644
--- a/ir/regalloc.c
+++ b/ir/regalloc.c
@@ -1197,6 +1197,7 @@ devirt(struct rega *ra, struct block *blk)
}
}
+ if (allnops) vfree(&blk->ins);
return allnops;
}
diff --git a/x86_64/emit.c b/x86_64/emit.c
index 783ea20..17ea1f3 100644
--- a/x86_64/emit.c
+++ b/x86_64/emit.c
@@ -1372,6 +1372,8 @@ emitbin(struct function *fn)
emitinstr(pcode, fn, blk, i, &instrtab[blk->ins.p[i]]);
if (blk->jmp.t == Jret) {
+ if (blk->lnext != fn->entry && blk->lnext->jmp.t == Jret && blk->lnext->ins.n == 0)
+ continue; /* fallthru to next blk's RET */
/* epilogue */
if (fn->stksiz && (saverestore || !usebp))
Xadd(pcode, KPTR, mkoper(OREG, .reg = RSP), mkoper(OIMM, .imm = fn->stksiz));