From 517ad201ff6ca1ef0d78c22f31de747709fb7c99 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Sun, 26 Feb 2017 13:43:48 -0500 Subject: Add testcase for #13340 Test Plan: Validate Reviewers: rwbarton, austin Reviewed By: rwbarton Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3215 --- testsuite/tests/simplCore/should_compile/Makefile | 6 ++++++ testsuite/tests/simplCore/should_compile/T13340.hs | 6 ++++++ testsuite/tests/simplCore/should_compile/T13340.stdout | 1 + testsuite/tests/simplCore/should_compile/all.T | 1 + 4 files changed, 14 insertions(+) create mode 100644 testsuite/tests/simplCore/should_compile/T13340.hs create mode 100644 testsuite/tests/simplCore/should_compile/T13340.stdout (limited to 'testsuite/tests') diff --git a/testsuite/tests/simplCore/should_compile/Makefile b/testsuite/tests/simplCore/should_compile/Makefile index 7dd784bf45..1206ad6f6a 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 0000000000..813855ba97 --- /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/simplCore/should_compile/T13340.stdout b/testsuite/tests/simplCore/should_compile/T13340.stdout new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T13340.stdout @@ -0,0 +1 @@ +1 diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index 53f5ade353..5227c1139d 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']) -- cgit v1.2.1