Drop dead Given bindings in setImplicationStatus
authorSimon Peyton Jones <simonpj@microsoft.com>
Thu, 4 Jan 2018 12:32:13 +0000 (12:32 +0000)
committerSimon Peyton Jones <simonpj@microsoft.com>
Thu, 4 Jan 2018 16:15:18 +0000 (16:15 +0000)
commit954cbc7c106a20639960f55ebb85c5c972652d41
treef7911596036333cbe9d091aa8728695a058b03f8
parent6c34824434a67baa34e4ee2ddb753708eb61c5bc
Drop dead Given bindings in setImplicationStatus

Trac #13032 pointed out that we sometimes generate unused
bindings for Givens, and (worse still) we can't always discard
them later (we don't drop a case binding unless we can prove
that the scrutinee is non-bottom.

It looks as if this may be a major reason for the performace
problems in #14338 (see comment:29).

This patch fixes the problem at source, by pruning away all the
dead Givens.  See Note [Delete dead Given evidence bindings]

Remarkably, compiler allocation falls by 23% in
perf/compiler/T12227!

I have not confirmed whether this change actualy helps with
14 files changed:
compiler/basicTypes/VarEnv.hs
compiler/typecheck/TcEvidence.hs
compiler/typecheck/TcInstDcls.hs
compiler/typecheck/TcRnMonad.hs
compiler/typecheck/TcRnTypes.hs
compiler/typecheck/TcSMonad.hs
compiler/typecheck/TcSimplify.hs
compiler/typecheck/TcUnify.hs
testsuite/tests/indexed-types/should_compile/T7837.stderr
testsuite/tests/perf/compiler/all.T
testsuite/tests/simplCore/should_compile/T4398.stderr
testsuite/tests/typecheck/should_compile/T13032.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_compile/T13032.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_compile/all.T