Fix CaseIdentity optimisation AGAIN
authorSimon Peyton Jones <simonpj@microsoft.com>
Tue, 14 Mar 2017 13:52:48 +0000 (13:52 +0000)
committerSimon Peyton Jones <simonpj@microsoft.com>
Tue, 14 Mar 2017 13:55:30 +0000 (13:55 +0000)
commit82b40598ea7a9c00abdeae37bc47896f880fbbdc
treea70448d6ed7efb5c4b57a65d4d07bb012ea08c0d
parent50512c6b2bd878f0be5e1c7b85cadf22094aaa5a
Fix CaseIdentity optimisation AGAIN

In this commit
    commit 02ac2974ce8e537372bff8d9e0a6efb461ed2c59
    Author: Simon Peyton Jones <simonpj@microsoft.com>
    Date:   Wed Nov 16 10:37:47 2011 +0000

    Fix CaseIdentity optimisaion

    In fixing one bug I'd introduced another;
       case x of { T -> T; F -> F }
    wasn't getting optmised!  Trivial to fix.

I introduced yet another!  This line of code in SimplUtils.mkCase1

    check_eq (Var v)    (DataAlt con) []   = v == dataConWorkId con
                                             -- Optimisation only

is patently false when arg_tys is non-empty.  Astonishing that it
has not shown up before now.

Easily fixed though.  This was all shown up by Trac #13417, which is
now fixed.

Merge to 8.0, 8.2.
compiler/simplCore/SimplUtils.hs
testsuite/tests/simplCore/should_compile/T13417.hs [new file with mode: 0644]
testsuite/tests/simplCore/should_compile/all.T