forked from grin-compiler/ghc-wpc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CSE: Walk past join point lambdas (#15002)
As the CSE transformation traverses the syntax tree, it needs to go past the lambdas of a join point, and only look for CSE opportunities inside, as a join point’s lambdas must be preserved. Simple fix; comes with a Note and a test case. Thanks to Ryan Scott for an excellently minimized test case, and for bisecting GHC. Differential Revision: https://phabricator.haskell.org/D4572
- Loading branch information
Showing
3 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module T15002 where | ||
|
||
import Control.Concurrent.MVar (MVar, modifyMVar_, putMVar) | ||
import Data.Foldable (for_) | ||
|
||
broadcastThen :: Either [MVar a] a -> MVar (Either [MVar a] a) -> a -> IO () | ||
broadcastThen finalState mv x = | ||
modifyMVar_ mv $ \mx -> do | ||
case mx of | ||
Left ls -> do for_ ls (`putMVar` x) | ||
return finalState | ||
Right _ -> return finalState |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters