ryukzak / nitta

BSD 3-Clause "New" or "Revised" License
21 stars 6 forks source link

Fix constant folding refactoring #196

Open ryukzak opened 2 years ago

ryukzak commented 2 years ago

In test:

            , unitTestCase "target system: autosynthesis, constant folding 1" def $ do
                setNetwork march
                setBusType pInt
                assignLua
                    [__i|
                        function sum(a)
                            local d = 1 + 2 + a
                            sum(d)
                        end
                        sum(0)
                        |]
                synthesizeAndCoSim
                mkConstantFolding
                    [ add "!1#0" "!2#0" ["_0#d"]
                    , constant 2 ["!2#0"]
                    , constant 1 ["!1#0"]
                    ]
                    -- FIXME: should be:
                    -- [ constant 3 ["_0#d"] ]
                    [ constant 3 ["_0#d"]
                    , constant 2 ["!2#0"]
                    , constant 1 ["!1#0"]
                    ]
                    >>= \r -> assertRefactor r
stack build --fast --test --test-arguments '-p "constant folding 1"'
ryukzak commented 10 months ago

Update in https://github.com/ryukzak/nitta/pull/274