Fix a nasty bug in exprIsExpandable
authorSimon Peyton Jones <simonpj@microsoft.com>
Fri, 20 Jan 2017 11:02:36 +0000 (11:02 +0000)
committerSimon Peyton Jones <simonpj@microsoft.com>
Fri, 20 Jan 2017 12:07:04 +0000 (12:07 +0000)
commit9be18ea4e5cbc53ce7769a30275332d68a4ab6b9
tree668d1399c51c80d25e408d0ecba39026aafa0435
parentbf1e1f3206f8b274c3ffa33cd7688a0b17eabd0b
Fix a nasty bug in exprIsExpandable

This bug has been lurking for ages: Trac #13155

The important semantic change is to ensure that exprIsExpandable
returns False for primop calls.  Previously exprIsExpandable used
exprIsCheap' which always used primOpIsCheap.

I took the opportunity to combine the code for exprIsCheap' (two
variants: exprIsCheap and exprIsExpandable) with that for
exprIsWorkFree.  Result is simpler, tighter, easier to understand.
And correct (at least wrt this bug)!
compiler/coreSyn/CoreArity.hs
compiler/coreSyn/CoreUtils.hs
testsuite/tests/simplCore/should_compile/Makefile
testsuite/tests/simplCore/should_compile/T13155.hs [new file with mode: 0644]
testsuite/tests/simplCore/should_compile/T13155.stdout [new file with mode: 0644]
testsuite/tests/simplCore/should_compile/all.T