diff options
| author | WormHeamer | 2025-08-10 23:36:33 -0400 |
|---|---|---|
| committer | WormHeamer | 2025-08-10 23:36:33 -0400 |
| commit | 27418008d4b492aff432c44fc92cd8485bcd5cf7 (patch) | |
| tree | cee93f42bb37f1e678557c8706bf5f73eb8628b7 | |
| parent | 6baa342580d525250f0842015b8f59ad19b7d540 (diff) | |
add idempotent optimizations
| -rw-r--r-- | peephole.c | 4 | ||||
| -rw-r--r-- | test.lang | 6 |
2 files changed, 3 insertions, 7 deletions
@@ -522,11 +522,11 @@ zero_no_effect: if (node_eql_i64(CAR(n), 0)) return CDR(n); case N_PROJ: if (T(CTRL(n), N_IF_ELSE) && CTRL(n)->type.t == T_TUPLE) { - /*if (CTRL(n)->val.tuple.data[n->val.i].type.lvl == T_XCTRL) { + if (CTRL(n)->val.tuple.data[n->val.i].type.lvl == T_XCTRL) { return node_new_lit(p, (Value) { .type = { .lvl = T_XCTRL, .t = T_NONE } }); - }*/ + } if (CTRL(n)->val.tuple.data[(n->val.i + 1) % CTRL(n)->val.tuple.len].type.lvl == T_XCTRL) { return CTRL(CTRL(n)); } @@ -6,10 +6,6 @@ return x + a }*/ -func one i64 { - return 1 -} - func main(a, b i64) i64 { - return a & a & b & a & b & b & b + return (a & b) & b & a } |
