diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2015-04-14 09:20:42 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2015-04-14 09:22:00 +0100 |
commit | d261d4cbcc867405f71d7c9580628f52978e2267 (patch) | |
tree | aeb2b0c1fa7c552327e941108855f3370cd2605c /testsuite/tests/stranal | |
parent | 919b51174163907d2bc3bb41aadf56aa8bb42e9b (diff) | |
download | haskell-d261d4cbcc867405f71d7c9580628f52978e2267.tar.gz |
Zap usage info in CSE (Trac #10218)
Trac #10218 reports a subtle bug that turned out to be:
- CSE invalidated the usage information computed
by earlier demand analysis, by increasing sharing
- that made a single-entry thunk into a multi-entry thunk
- and with -feager-blackholing, that led to <<loop>>
The patch fixes it by making the CSE pass zap usage information for
let-bound identifiers. It can be restored by -flate-dmd-anal.
(But making -flate-dmd-anal the default needs some careful work;
see Trac #7782.)
Diffstat (limited to 'testsuite/tests/stranal')
-rw-r--r-- | testsuite/tests/stranal/should_run/T10218.hs | 18 | ||||
-rw-r--r-- | testsuite/tests/stranal/should_run/T10218.stdout | 1 | ||||
-rw-r--r-- | testsuite/tests/stranal/should_run/all.T | 1 |
3 files changed, 20 insertions, 0 deletions
diff --git a/testsuite/tests/stranal/should_run/T10218.hs b/testsuite/tests/stranal/should_run/T10218.hs new file mode 100644 index 0000000000..572c6fdebf --- /dev/null +++ b/testsuite/tests/stranal/should_run/T10218.hs @@ -0,0 +1,18 @@ +{-# OPTIONS_GHC -feager-blackholing #-} + +module Main where + +{-# NOINLINE foo #-} +foo :: Bool -> Int -> Int -> Int +foo True _ x = 1 +foo False _ x = x+1 + +{-# NOINLINE bar #-} +bar :: Int -> (Int,Int) +bar x = let y1 = x * 2 + y2 = x * 2 + in (foo False y1 y2,foo False y2 y1) + +main = print (fst p + snd p) + where + p = bar 3 diff --git a/testsuite/tests/stranal/should_run/T10218.stdout b/testsuite/tests/stranal/should_run/T10218.stdout new file mode 100644 index 0000000000..8351c19397 --- /dev/null +++ b/testsuite/tests/stranal/should_run/T10218.stdout @@ -0,0 +1 @@ +14 diff --git a/testsuite/tests/stranal/should_run/all.T b/testsuite/tests/stranal/should_run/all.T index 7f64f85a11..8a82ce86a5 100644 --- a/testsuite/tests/stranal/should_run/all.T +++ b/testsuite/tests/stranal/should_run/all.T @@ -9,3 +9,4 @@ test('T2756b', normal, compile_and_run, ['']) test('T7649', normal, compile_and_run, ['']) test('T9254', normal, compile_and_run, ['']) test('T10148', normal, compile_and_run, ['']) +test('T10218', normal, compile_and_run, ['']) |