Matching cases in SpecConstr and Rules
This patch has zero effect. It includes comments,
a bit of refactoring, and a tiny bit of commment-out
code go implement the "matching cases" idea below.
In the end I've left it disabled because while I think
it does no harm I don't think it'll do any good either.
But I didn't want to lose the idea totally. There's
a thread called "Storable and constant memory" on
the libraries@haskell.org list (Apr 2010) about it.
Note [Matching cases]
~~~~~~~~~~~~~~~~~~~~~
{- NOTE: This idea is currently disabled. It really only works if
the primops involved are OkForSpeculation, and, since
they have side effects readIntOfAddr and touch are not.
Maybe we'll get back to this later . -}
Consider
f (case readIntOffAddr# p# i# realWorld# of { (# s#, n# #) ->
case touch# fp s# of { _ ->
I# n# } } )
This happened in a tight loop generated by stream fusion that
Roman encountered. We'd like to treat this just like the let
case, because the primops concerned are ok-for-speculation.
That is, we'd like to behave as if it had been
case readIntOffAddr# p# i# realWorld# of { (# s#, n# #) ->
case touch# fp s# of { _ ->
f (I# n# } } )