diff options
| author | WormHeamer | 2025-10-21 06:28:27 -0400 |
|---|---|---|
| committer | WormHeamer | 2025-10-21 06:28:27 -0400 |
| commit | 5ea989fc612ce219f29eaeb1d642ba7083b38599 (patch) | |
| tree | 90d2e563cb6574d8e73cbd1d5d48bfb3418b1302 | |
| parent | 2cb303eec6a65fbc8269a0eaedbf3f32d892972c (diff) | |
temporarily disable invalid division->shr optimization
| -rw-r--r-- | peephole.c | 3 | ||||
| -rw-r--r-- | test.lang | 2 |
2 files changed, 4 insertions, 1 deletions
@@ -435,10 +435,13 @@ Node *node_idealize(Node *n, Graph *p, Lexer *l) { lex_error_at(l, CDR(n)->src_pos, LE_ERROR, S("divisor always evaluates to zero")); } { + // TODO: this only holds true for _unsigned_ integers + /* int po2; if (T(CDR(n), N_LIT) && CDR(n)->type.t == T_INT && (po2 = u64_power_of_2(CDR(n)->val.u))) {; return NODE(N_OP_SHR, CAR(n), node_new_lit_i64(p, po2)); } + */ } break; case N_OP_OR: @@ -1,7 +1,7 @@ func main(a, b i64) i64 { let x = 2 if a < b { - x := 3 + a + x := 3 + (a / x) } else { x := 4 + (x * b) } |
