qbe

Internal scc patchset buffer for QBE
Log | Files | Refs | README | LICENSE

commit e562f219cf4abb9219f0cbd8d5c423603ce66cad
parent 4ce295adadc67f66b01b1841db394f60dda3956b
Author: Quentin Carbonneaux <quentin.carbonneaux@yale.edu>
Date:   Tue, 12 Apr 2016 13:44:50 -0400

oops, dumb bug in folding

Diffstat:
Mfold.c | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fold.c b/fold.c @@ -24,9 +24,9 @@ czero(Con *c, int w) if (c->type != CBits) return 0; if (w) - return !c->bits.i; + return c->bits.i == 0; else - return !(uint32_t)c->bits.i; + return (uint32_t)c->bits.i == 0; } static int @@ -291,9 +291,9 @@ fold(Fn *fn) renref(&b->jmp.arg, fn); if (b->jmp.type == JJnz && rtype(b->jmp.arg) == RCon) { b->jmp.type = JJmp; - b->jmp.arg = R; if (czero(&fn->con[b->jmp.arg.val], 0)) b->s1 = b->s2; + b->jmp.arg = R; b->s2 = 0; } pb = &b->link;