Discard reflexive casts during Simplify
authorRichard Eisenberg <rae@cs.brynmawr.edu>
Tue, 10 Apr 2018 14:23:42 +0000 (10:23 -0400)
committerBen Gamari <ben@smart-cactus.org>
Tue, 10 Apr 2018 15:36:00 +0000 (11:36 -0400)
commit7bb7f991e2b04b7daed079bab9e63884404802a0
treef95428f53c9f7a3b40e6473893b71273504e30f7
parentc054162ae151ff82d43e504836784a7bc7827d9f
Discard reflexive casts during Simplify

Trac #14735 (derived from Trac #11735) found that 75% of compile
time was being spent in simplCast. This patch is the first in a series
to deal with that problem.

This particular patch actually has very little effect on performance; it
just refactors simplCast so that it builds Refl coercions less often.
Refl coercions require us to compute the type to put inside them, and
even if that's done lazily it is still work and code. Instead we use
Maybe Coercion with Nothing for Refl. This change also percolates to
pushCoTyArg and pushValArg.

Reviewers: goldfire, bgamari, simonpj

Reviewed By: simonpj

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14737

Differential Revision: https://phabricator.haskell.org/D4395
compiler/coreSyn/CoreOpt.hs
compiler/simplCore/Simplify.hs