diff options
author | klebinger.andreas@gmx.at <klebinger.andreas@gmx.at> | 2018-06-07 13:26:19 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-06-07 18:06:29 -0400 |
commit | efea32cf2c41d35f2ba5a79bf70cc7768b7b0fd5 (patch) | |
tree | d19e185a39cb2c5dc4862d0056c1bcc78d725f47 /testsuite | |
parent | 767536ccf95d8352d146b6544857b28d9c42937e (diff) | |
download | haskell-efea32cf2c41d35f2ba5a79bf70cc7768b7b0fd5.tar.gz |
Check if both branches of an Cmm if have the same target.
This for some reason or the other and makes it into the final
binary. I've added the check to ContFlowOpt as that seems
like a logical place for this.
In a regular nofib run there were 30 occurences of this pattern.
Test Plan: ci
Reviewers: bgamari, simonmar, dfeuer, jrtc27, tdammers
Reviewed By: bgamari, simonmar
Subscribers: tdammers, dfeuer, rwbarton, thomie, carter
GHC Trac Issues: #15188
Differential Revision: https://phabricator.haskell.org/D4740
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/cmm/opt/Makefile | 6 | ||||
-rw-r--r-- | testsuite/tests/cmm/opt/T15188.cmm | 6 | ||||
-rw-r--r-- | testsuite/tests/cmm/opt/T15188.stdout | 1 | ||||
-rw-r--r-- | testsuite/tests/cmm/opt/all.T | 3 |
4 files changed, 16 insertions, 0 deletions
diff --git a/testsuite/tests/cmm/opt/Makefile b/testsuite/tests/cmm/opt/Makefile new file mode 100644 index 0000000000..3c462ec0c0 --- /dev/null +++ b/testsuite/tests/cmm/opt/Makefile @@ -0,0 +1,6 @@ +TOP=../../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk + +T15188: + '$(TEST_HC)' $(TEST_HC_OPTS) -c -O -ddump-cmm-cps -dsuppress-all T15188.cmm | grep if ; echo $$? diff --git a/testsuite/tests/cmm/opt/T15188.cmm b/testsuite/tests/cmm/opt/T15188.cmm new file mode 100644 index 0000000000..59df92d78e --- /dev/null +++ b/testsuite/tests/cmm/opt/T15188.cmm @@ -0,0 +1,6 @@ +func(bits64 r2) { + foo: + if (r2 == 0) { goto bar; } else { goto bar; } + bar: + return (1); +} diff --git a/testsuite/tests/cmm/opt/T15188.stdout b/testsuite/tests/cmm/opt/T15188.stdout new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/testsuite/tests/cmm/opt/T15188.stdout @@ -0,0 +1 @@ +1 diff --git a/testsuite/tests/cmm/opt/all.T b/testsuite/tests/cmm/opt/all.T new file mode 100644 index 0000000000..b2c0f5f8e7 --- /dev/null +++ b/testsuite/tests/cmm/opt/all.T @@ -0,0 +1,3 @@ +# Verify that we optimize away conditional branches which always jump +# to the same target. +test('T15188', normal, run_command, ['$MAKE -s --no-print-directory T15188']) |