summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
authorJoachim Breitner <mail@joachim-breitner.de>2018-04-05 10:02:25 -0400
committerJoachim Breitner <mail@joachim-breitner.de>2018-04-09 22:15:03 -0400
commitae0cff0a1834d8b041b06d0e1ab6ce969aac44c8 (patch)
tree93494c1d152facd477359d30ea0ee88510a9dc72 /testsuite/tests
parent1aa1d405d8212a99ac24dcfd48024a17c3ffd296 (diff)
downloadhaskell-ae0cff0a1834d8b041b06d0e1ab6ce969aac44c8.tar.gz
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
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/simplCore/should_compile/T15002.hs12
-rw-r--r--testsuite/tests/simplCore/should_compile/all.T1
2 files changed, 13 insertions, 0 deletions
diff --git a/testsuite/tests/simplCore/should_compile/T15002.hs b/testsuite/tests/simplCore/should_compile/T15002.hs
new file mode 100644
index 0000000000..a5918c5234
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T15002.hs
@@ -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
diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T
index a521a1084e..016b4392f0 100644
--- a/testsuite/tests/simplCore/should_compile/all.T
+++ b/testsuite/tests/simplCore/should_compile/all.T
@@ -301,3 +301,4 @@ test('T14978',
normal,
run_command,
['$MAKE -s --no-print-directory T14978'])
+test('T15002', [ req_profiling ], compile, ['-O -fprof-auto -prof'])