File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff 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 ("[]" ))
You can’t perform that action at this time.
0 commit comments