haskell / hoopl

Higher-order optimization library
http://hackage.haskell.org/package/hoopl
Other
73 stars 27 forks source link

Fix dead code elimination used in tests #11

Closed michalt closed 9 years ago

michalt commented 9 years ago

The helper functions to fold over instructions and expressions in test/OptSupport have a bug where they would not recurse for complex expressions. And since testing/Live module depends on it, complex expressions would not be fully analyzed, leading to removal of code that is not dead, e.g.,

  var1 = m[0]
  var1 = m[var1] + m[var1]

would get rewritten to just

  var1 = m[var1] + m[var1]

which is clearly wrong.

Note that this bug affects only Hoopl's tests.