#5658: Strict bindings are wrongly floated out of case alternatives.
---------------------------------+------------------------------------------
Reporter: benl | Owner: benl
Type: bug | Status: new
Priority: normal | Milestone: 7.4.1
Component: Compiler | Version: 7.2.1
Keywords: | Os: Unknown/Multiple
Architecture: Unknown/Multiple | Failure: Runtime crash
Difficulty: Unknown | Testcase:
Blockedby: | Blocking:
Related: |
---------------------------------+------------------------------------------
Comment(by rl):
It turns out that this fix can decrease performance because now,
`index*Array#` operations can't be eliminated or moved ''into'' cases. For
an example of mine, we generated this code before:
{{{
$weq_loop0_s1Ty =
\ (ww_s1Sv :: Int#) (ww1_s1Sz :: Int#) ->
case >=# ww_s1Sv ipv1_s1K9 of _ {
False ->
case >=# ww1_s1Sz sc1_s1VP of _ {
False ->
case indexIntArray# ipv2_s1Ka (+# ipv_s1K8 ww_s1Sv)
of wild_a1rf { __DEFAULT ->
case indexIntArray# sc2_s1VQ (+# sc_s1VO ww1_s1Sz)
of wild3_X1rU { __DEFAULT ->
case ==# wild_a1rf wild3_X1rU of _ {
False -> False;
True -> $weq_loop0_s1Ty (+# ww_s1Sv 1) (+# ww1_s1Sz 1)
}
}
};
True -> False
};
True -> >=# ww1_s1Sz sc1_s1VP
};
}}}
And now we generate this:
{{{
$weq_loop0_s1TF =
\ (ww_s1SC :: Int#) (ww1_s1SG :: Int#) ->
case >=# ww_s1SC ipv1_s1Kg of _ {
False ->
case indexIntArray# ipv2_s1Kh (+# ipv_s1Kf ww_s1SC)
of wild_a1rg { __DEFAULT ->
case >=# ww1_s1SG sc1_s1VW of _ {
False ->
case indexIntArray# sc2_s1VX (+# sc_s1VV ww1_s1SG)
of wild3_X1rU { __DEFAULT ->
case ==# wild_a1rg wild3_X1rU of _ {
False -> False;
True -> $weq_loop0_s1TF (+# ww_s1SC 1) (+# ww1_s1SG 1)
}
};
True -> False
}
};
True ->
case >=# ww1_s1SG sc1_s1VW of _ {
False ->
case indexIntArray# sc2_s1VX (+# sc_s1VV ww1_s1SG)
of _ { __DEFAULT ->
False
};
True -> True
}
};
}}}
I'm not sure if this is the intended semantics of `can_fail`. If so, we
might want something weaker than `can_fail` for things that shouldn't be
executed speculatively but are ok to not executed at all.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5658#comment:10>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs