nponeccop / HNC

HN Compiler
GNU Lesser General Public License v3.0
62 stars 5 forks source link

Optimization breaks allDigits-ho-2.hn #50

Closed nponeccop closed 9 years ago

nponeccop commented 11 years ago

HN source:

allDigits ss = {
    comp f g = {
        h x = f (g x)
        h
    }
    loopCond = comp incr incr
    loopCond ss
}

A correct partial inlining

allDigits ss = {
    loopCond = {
        h x = incr (incr x)
        h
    }
    loopCond ss
}

Expected result:

allDigits ss = incr (incr ss)

Actual result:

allDigits ss = {
    h x = f (g x)
    h
}

ss and inc are lost.

nponeccop commented 9 years ago

Fixed