summaryrefslogtreecommitdiff
path: root/compiler/main/StaticFlags.hs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2012-01-13 17:50:00 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2012-01-13 17:50:00 +0000
commit601c983dd0bada6b49bdadd8f172fd4eacac4b0c (patch)
tree58c99eb2753958b5a0192ec050a385b9badcc847 /compiler/main/StaticFlags.hs
parentc96022cbfae44ea9180b78e3c37467613ac98cec (diff)
downloadhaskell-601c983dd0bada6b49bdadd8f172fd4eacac4b0c.tar.gz
Add -faggressive-primops plus refactoring in CoreUtils
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] 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. So I wanted a new function CoreUtils.exprCertainlyTerminates. In doing this I ended up with a significant refactoring in CoreUtils. The new structure has quite a lot of nice sharing: exprIsCheap = exprIsCheap' isHNFApp exprIsExpandable = exprIsCheap' isConLikeApp exprIsHNF = exprIsHNFlike isHNFApp exprIsConLike = exprIsHNFlike isConLikeApp exprCertainlyTerminates = exprIsHNFlike isTerminatingApp
Diffstat (limited to 'compiler/main/StaticFlags.hs')
-rw-r--r--compiler/main/StaticFlags.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/main/StaticFlags.hs b/compiler/main/StaticFlags.hs
index c2f8674aa9..3c13e08372 100644
--- a/compiler/main/StaticFlags.hs
+++ b/compiler/main/StaticFlags.hs
@@ -62,6 +62,7 @@ module StaticFlags (
opt_SimplExcessPrecision,
opt_NoOptCoercion,
opt_MaxWorkerArgs,
+ opt_AggressivePrimOps,
-- Unfolding control
opt_UF_CreationThreshold,
@@ -321,6 +322,11 @@ opt_NoStateHack = lookUp (fsLit "-fno-state-hack")
opt_CprOff :: Bool
opt_CprOff = lookUp (fsLit "-fcpr-off")
-- Switch off CPR analysis in the new demand analyser
+
+opt_AggressivePrimOps :: Bool
+opt_AggressivePrimOps = lookUp (fsLit "-faggressive-primops")
+ -- See Note [Aggressive PrimOps] in PrimOp
+
opt_MaxWorkerArgs :: Int
opt_MaxWorkerArgs = lookup_def_int "-fmax-worker-args" (10::Int)