diff options
author | Simon Jakobi <simon.jakobi@gmail.com> | 2021-04-03 01:00:20 +0200 |
---|---|---|
committer | Simon Jakobi <simon.jakobi@gmail.com> | 2021-04-03 01:04:30 +0200 |
commit | 2975ea4706137031aa9fcc479bb8d55311d664d1 (patch) | |
tree | 52e401b258d328ddd35b6c9d9f7cf2ac9d66a038 | |
parent | ce706faeef3964116c6e1dd0e6ae2f2e77fde57d (diff) | |
download | haskell-wip/sjakobi/T7378-test.tar.gz |
Add regression test for #7378wip/sjakobi/T7378-test
Closes #7378.
-rw-r--r-- | testsuite/tests/simplCore/should_compile/T7378.hs | 11 | ||||
-rw-r--r-- | testsuite/tests/simplCore/should_compile/T7378.stderr | 3 | ||||
-rw-r--r-- | testsuite/tests/simplCore/should_compile/all.T | 1 |
3 files changed, 15 insertions, 0 deletions
diff --git a/testsuite/tests/simplCore/should_compile/T7378.hs b/testsuite/tests/simplCore/should_compile/T7378.hs new file mode 100644 index 0000000000..d32014bb5a --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T7378.hs @@ -0,0 +1,11 @@ +module T7378 where + +-- The original example, now compiled to a simple right-shift +fun0 :: Int -> Int +fun0 i = i `div` 2 + +-- We expect CSE to combine the alternatives of a redundant +-- case analysis on `i > 0`. +-- This didn't happen before GHC 8.2. +fun1 :: Int -> Int +fun1 i = i `div` 12345 diff --git a/testsuite/tests/simplCore/should_compile/T7378.stderr b/testsuite/tests/simplCore/should_compile/T7378.stderr new file mode 100644 index 0000000000..b8bee5ec94 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T7378.stderr @@ -0,0 +1,3 @@ + case i of { I# ww1 -> + case <# ww1 0# of { + = / i -> case i of { I# ww1 -> I# (uncheckedIShiftRA# ww1 1#) } diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index 3a16d55508..70324ea44d 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -130,6 +130,7 @@ test('T6082-RULE', normal, compile, ['']) test('T7165', [], makefile_test, ['T7165']) test('T7287', normal, compile, ['']) test('T7360', only_ways(['optasm']), compile, ['-ddump-simpl -dsuppress-uniques -dsuppress-ticks']) +test('T7378', [grep_errmsg(r'case'), only_ways(['optasm'])], compile, ['-O -funfolding-use-threshold=109 -ddump-simpl -dsuppress-all -dsuppress-uniques']) test('T5366', normal, makefile_test, ['T5366']) |