Set strictness correctly for JoinIds
authorSimon Peyton Jones <simonpj@microsoft.com>
Tue, 21 Aug 2018 08:56:39 +0000 (09:56 +0100)
committerSimon Peyton Jones <simonpj@microsoft.com>
Tue, 21 Aug 2018 13:00:48 +0000 (14:00 +0100)
commitce6ce788251b6102f5c1b878ffec53ba7ad678b5
treeabce984aa54c6c7eaae7678b822086f50481a2a2
parent9c4e6c6b1affd410604f8f76ecf56abfcc5cccb6
Set strictness correctly for JoinIds

We were failing to keep correct strictness info when eta-expanding
join points; Trac #15517.   The situation was something like

  \q v eta ->
     let j x = error "blah
         -- STR Lx   bottoming!
     in case y of
           A -> j x eta
           B -> blah
           C -> j x eta

So we spot j as a join point and eta-expand it.  But we must
also adjust the stricness info, else it vlaimes to bottom after
one arg is applied but now it has become two.

I fixed this in two places:

 - In CoreOpt.joinPointBinding_maybe, adjust strictness info

 - In SimplUtils.tryEtaExpandRhs, return consistent values
   for arity and bottom-ness
compiler/basicTypes/Demand.hs
compiler/coreSyn/CoreOpt.hs
compiler/simplCore/SimplUtils.hs
testsuite/tests/simplCore/should_compile/T15517.hs [new file with mode: 0644]
testsuite/tests/simplCore/should_compile/T15517a.hs [new file with mode: 0644]
testsuite/tests/simplCore/should_compile/all.T