[commit: ghc] master: Add testcase for #13340 (517ad20)

git at git.haskell.org git at git.haskell.org
Sun Feb 26 19:56:43 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/517ad201ff6ca1ef0d78c22f31de747709fb7c99/ghc

>---------------------------------------------------------------

commit 517ad201ff6ca1ef0d78c22f31de747709fb7c99
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Sun Feb 26 13:43:48 2017 -0500

    Add testcase for #13340
    
    Test Plan: Validate
    
    Reviewers: rwbarton, austin
    
    Reviewed By: rwbarton
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D3215


>---------------------------------------------------------------

517ad201ff6ca1ef0d78c22f31de747709fb7c99
 testsuite/tests/simplCore/should_compile/Makefile                   | 6 ++++++
 testsuite/tests/simplCore/should_compile/T13340.hs                  | 6 ++++++
 .../bkprun02.stdout => simplCore/should_compile/T13340.stdout}      | 0
 testsuite/tests/simplCore/should_compile/all.T                      | 1 +
 4 files changed, 13 insertions(+)

diff --git a/testsuite/tests/simplCore/should_compile/Makefile b/testsuite/tests/simplCore/should_compile/Makefile
index 7dd784b..1206ad6 100644
--- a/testsuite/tests/simplCore/should_compile/Makefile
+++ b/testsuite/tests/simplCore/should_compile/Makefile
@@ -195,3 +195,9 @@ T13025:
 str-rules:
 	$(RM) -f str-rules.hi str-rules.o
 	'$(TEST_HC)' $(TEST_HC_OPTS) -c -O str-rules.hs -ddump-simpl | grep -o '"@@@[^"].*"#' | sort
+
+# We expect there to be precisely one use of +# in the simplified Core as f and
+# g should have been collapsed into one defininition by CSE.
+.PHONY: T13340
+T13340:
+	'$(TEST_HC)' $(TEST_HC_OPTS) -c -O T13340.hs -ddump-simpl -dsuppress-all | grep '\+#' | wc -l
diff --git a/testsuite/tests/simplCore/should_compile/T13340.hs b/testsuite/tests/simplCore/should_compile/T13340.hs
new file mode 100644
index 0000000..813855b
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T13340.hs
@@ -0,0 +1,6 @@
+module Hi where
+
+-- These two should be de-duplicated by CSE
+f, g :: Int -> Int
+f x = 2 + x
+g x = 2 + x
diff --git a/testsuite/tests/backpack/should_run/bkprun02.stdout b/testsuite/tests/simplCore/should_compile/T13340.stdout
similarity index 100%
copy from testsuite/tests/backpack/should_run/bkprun02.stdout
copy to testsuite/tests/simplCore/should_compile/T13340.stdout
diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T
index 53f5ade..5227c11 100644
--- a/testsuite/tests/simplCore/should_compile/all.T
+++ b/testsuite/tests/simplCore/should_compile/all.T
@@ -244,3 +244,4 @@ test('T13317',
      normal,
      run_command,
      ['$MAKE -s --no-print-directory T13317'])
+test('T13340', expect_broken(13340), run_command, ['$MAKE -s --no-print-directory T13340'])



More information about the ghc-commits mailing list