Improvements to demand analysis
authorSimon Peyton Jones <simonpj@microsoft.com>
Wed, 12 Dec 2018 17:22:07 +0000 (17:22 +0000)
committerSimon Peyton Jones <simonpj@microsoft.com>
Wed, 12 Dec 2018 17:38:25 +0000 (17:38 +0000)
commitd77501cd5b9060e38acd50e11e0c5aae89d75b65
treea6cba21b5adb5c04b476c92bf33436bd1a880981
parentded4a1db4d61b1bc8b5fd73e8eb87cf572efda35
Improvements to demand analysis

This patch collects a few improvements triggered by Trac #15696,
and fixing Trac #16029

* Stop making toCleanDmd behave specially for unlifted types.
  This special case was the cause of stupid behaviour in Trac
  #16029.  And to my joy I discovered the let/app invariant
  rendered it unnecessary.  (Maybe the special case pre-dated
  the let/app invariant.)

  Result: less special-case handling in the compiler, and
  better perf for the compiled code.

* In WwLib.mkWWstr_one, treat seqDmd like U(AAA).  It was not
  being so treated before, which again led to stupid code.

* Update and improve Notes

There are .stderr test wibbles because we get slightly different
strictness signatures for an argumment of unlifted type:
    <L,U> rather than <S,U>        for Int#
    <S,U> rather than <S(S),U(U)>  for Int
17 files changed:
compiler/basicTypes/Demand.hs
compiler/simplStg/StgLiftLams/Analysis.hs
compiler/stranal/DmdAnal.hs
compiler/stranal/WwLib.hs
testsuite/tests/numeric/should_compile/T7116.stdout
testsuite/tests/simplCore/should_compile/T13143.stderr
testsuite/tests/simplCore/should_compile/T13543.stderr
testsuite/tests/simplCore/should_compile/T3772.stdout
testsuite/tests/simplCore/should_compile/T4930.stderr
testsuite/tests/simplCore/should_compile/spec-inline.stderr
testsuite/tests/stranal/should_compile/Makefile
testsuite/tests/stranal/should_compile/T16029.hs [new file with mode: 0644]
testsuite/tests/stranal/should_compile/T16029.stdout [new file with mode: 0644]
testsuite/tests/stranal/should_compile/all.T
testsuite/tests/stranal/sigs/HyperStrUse.stderr
testsuite/tests/stranal/sigs/T12370.stderr
testsuite/tests/stranal/sigs/T8598.stderr