Commit f3cc3456 authored by Simon Peyton Jones's avatar Simon Peyton Jones

Add strictness for runRW#

runRW# isn't inlined until CorePrep, so it's good to expose its
strictness.  Moreover, if we don't we can get obscure failures
in coreToStg; see Note [runRW arg] in CorePrep.

This fixes Trac #11291, and makes DfltProb1 compile with -O
always in order to expose it more vigorously
parent ab0d733d
......@@ -1180,6 +1180,13 @@ runRWId :: Id -- See Note [runRW magic] in this module
runRWId = pcMiscPrelId runRWName ty info
info = noCafIdInfo `setInlinePragInfo` neverInlinePragma
`setStrictnessInfo` strict_sig
`setArityInfo` 1
strict_sig = mkClosedStrictSig [strictApply1Dmd] topRes
-- Important to express its strictness,
-- since it is not inlined until CorePrep
-- Also see Note [runRW arg] in CorePrep
-- State# RealWorld
stateRW = mkTyConApp statePrimTyCon [realWorldTy]
-- (# State# RealWorld, o #)
......@@ -518,6 +518,18 @@ cpeRhsE env (Var f `App` _levity `App` _type `App` arg)
= case arg of -- beta reducing if possible
Lam s body -> cpeRhsE (extendCorePrepEnv env s realWorldPrimId) body
_ -> cpeRhsE env (arg `App` Var realWorldPrimId)
-- See Note [runRW arg]
{- Note [runRW arg]
If we got, say
runRW# (case bot of {})
which happened in Trac #11291, we do /not/ want to turn it into
(case bot of {}) realWorldPrimId#
because that gives a panic in CoreToStg.myCollectArgs, which expects
only variables in function position. But if we are sure to make
runRW# strict (which we do in MkId), this can't happen
cpeRhsE env expr@(App {}) = cpeApp env expr
......@@ -383,7 +383,8 @@ test('T5792',normal,run_command,
test('PolytypeDecomp', normal, compile, [''])
test('T6011', normal, compile, [''])
test('T6055', normal, compile, [''])
test('DfltProb1', normal, compile, [''])
test('DfltProb1', normal, compile, ['-O'])
# Add -O for DfltProb1 to expose Trac #11291
test('DfltProb2', normal, compile, [''])
test('T6134', normal, compile, [''])
test('T6018', extra_clean(['T6018.hi' , 'T6018.o'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment