summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--peephole.c3
-rw-r--r--test.lang2
2 files changed, 4 insertions, 1 deletions
diff --git a/peephole.c b/peephole.c
index 71acd77..a0fd339 100644
--- a/peephole.c
+++ b/peephole.c
@@ -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:
diff --git a/test.lang b/test.lang
index db0ff66..52e100b 100644
--- a/test.lang
+++ b/test.lang
@@ -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)
}