Fix dead code elimination used in tests
authorMichal Terepeta <michal.terepeta@gmail.com>
Sun, 28 Jun 2015 15:03:45 +0000 (17:03 +0200)
committerMichal Terepeta <michal.terepeta@gmail.com>
Sun, 5 Jul 2015 11:55:17 +0000 (13:55 +0200)
commit782ffec38719d723be775eb00a5d527f81b75a7b
tree4ba75401256d46a9b6fed1def830fa2b1d7d57d9
parent19526cc258a8bef851d828ad038a4a40ab5b3c06
Fix dead code elimination used in tests

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.
testing/Main.hs
testing/OptSupport.hs
testing/tests/test6 [new file with mode: 0644]
testing/tests/test6.expected [new file with mode: 0644]