Add -faggressive-primops
authorSimon Peyton Jones <simonpj@microsoft.com>
Fri, 27 Apr 2012 15:25:12 +0000 (16:25 +0100)
committerSimon Peyton Jones <simonpj@microsoft.com>
Fri, 27 Apr 2012 15:25:12 +0000 (16:25 +0100)
commit745ec959ff647c3a455767d20f6f37e9a0cc65aa
tree30252814090910034d6bb40b1d865f4f763cfaab
parent5519566f256e264516caa86bc9ce84de21d98bb2
Add -faggressive-primops

I'm experimenting with making GHC a bit more aggressive about

  a) dropping case expressions if the result is unused
        Simplify.rebuildCase, CaseElim equation

  b) floating case expressions inwards
        FloatIn.fiExpr, AnnCase

In both cases the new behaviour is gotten with a static (debug)
flag -faggressive-primops.  The extra "aggression" is to allow
discarding and floating in for side-effecting operations.  See
the new, extensive Note [PrimOp can_fail and has_side_effects]
and Note [Aggressive PrimOps] in PrimoOp.

When discarding a case with unused binders, in the lifted-type
case it's definitely ok if the scrutinee terminates; previously
we were checking exprOkForSpeculation, which is significantly
worse.

There's a related change to CoreUtils/CoreArity, but I'll put that
in the next commit.
compiler/main/StaticFlagParser.hs
compiler/main/StaticFlags.hs
compiler/prelude/PrimOp.lhs
compiler/simplCore/FloatIn.lhs
compiler/simplCore/Simplify.lhs