Skip to content

Commit de09b1e

Browse files
committed
.
1 parent 022f174 commit de09b1e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

ir.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -887,6 +887,7 @@ def run(self) -> dict[Instr, ConstantLattice]:
887887
match (self.type_of(instr.operands[0]), self.type_of(instr.operands[1])):
888888
case (CInt(int(l)), CInt(int(r))):
889889
new_type = CInt(l + r)
890+
instr.make_equal_to(Const(Int(l+r)))
890891
case (CInt(_), CInt(_)):
891892
new_type = CInt()
892893
elif isinstance(instr, IntSub):
@@ -2105,6 +2106,21 @@ def test_int_add(self) -> None:
21052106
},
21062107
)
21072108

2109+
self.assertEqual(
2110+
compiler.fn.to_string(InstrId()),
2111+
"""\
2112+
fn0 {
2113+
bb0 {
2114+
v0 = Const<1>
2115+
v1 = Const<2>
2116+
v2 = Const<3>
2117+
v3 = Const<5>
2118+
v4 = Const<6>
2119+
Return v4
2120+
}
2121+
}""",
2122+
)
2123+
21082124
def test_empty_list(self) -> None:
21092125
compiler = Compiler()
21102126
compiler.compile_body({}, _parse("[]"))

0 commit comments

Comments
 (0)