[commit: ghc] wip/T15002: CSE: in bind_cse, adhere to noCSE (fixes #15002) (8b833ab)
git at git.haskell.org
git at git.haskell.org
Thu Apr 5 14:04:28 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/T15002
Link : http://ghc.haskell.org/trac/ghc/changeset/8b833ab90321c66f583a1d8268e16d181ef3ff6c/ghc
>---------------------------------------------------------------
commit 8b833ab90321c66f583a1d8268e16d181ef3ff6c
Author: Joachim Breitner <mail at joachim-breitner.de>
Date: Thu Apr 5 10:02:25 2018 -0400
CSE: in bind_cse, adhere to noCSE (fixes #15002)
Differential Revision: https://phabricator.haskell.org/D4572
>---------------------------------------------------------------
8b833ab90321c66f583a1d8268e16d181ef3ff6c
compiler/simplCore/CSE.hs | 3 +++
testsuite/tests/simplCore/should_compile/T15002.hs | 12 ++++++++++++
testsuite/tests/simplCore/should_compile/all.T | 1 +
3 files changed, 16 insertions(+)
diff --git a/compiler/simplCore/CSE.hs b/compiler/simplCore/CSE.hs
index 8f61128..09e23f5 100644
--- a/compiler/simplCore/CSE.hs
+++ b/compiler/simplCore/CSE.hs
@@ -353,6 +353,9 @@ cse_bind toplevel env (in_id, in_rhs) out_id
-- See Note [Take care with literal strings]
= (env', (out_id, in_rhs))
+ | noCSE in_id
+ = (env', (out_id, in_rhs))
+
| otherwise
= (env', (out_id', out_rhs))
where
diff --git a/testsuite/tests/simplCore/should_compile/T15002.hs b/testsuite/tests/simplCore/should_compile/T15002.hs
new file mode 100644
index 0000000..a5918c5
--- /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 a521a10..016b439 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'])
More information about the ghc-commits
mailing list