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]:
887
887
match (self .type_of (instr .operands [0 ]), self .type_of (instr .operands [1 ])):
888
888
case (CInt (int (l )), CInt (int (r ))):
889
889
new_type = CInt (l + r )
890
+ instr .make_equal_to (Const (Int (l + r )))
890
891
case (CInt (_), CInt (_)):
891
892
new_type = CInt ()
892
893
elif isinstance (instr , IntSub ):
@@ -2105,6 +2106,21 @@ def test_int_add(self) -> None:
2105
2106
},
2106
2107
)
2107
2108
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
+
2108
2124
def test_empty_list (self ) -> None :
2109
2125
compiler = Compiler ()
2110
2126
compiler .compile_body ({}, _parse ("[]" ))
You can’t perform that action at this time.
0 commit comments