diff options
author | Gabor Greif <ggreif@gmail.com> | 2018-01-29 14:34:25 +0100 |
---|---|---|
committer | Gabor Greif <ggreif@gmail.com> | 2019-04-15 17:19:03 -0400 |
commit | be05bd8168b0ea65d63dc0093a5c8781a2528500 (patch) | |
tree | d45ed24579c4d084c73884da9589da25b8dcf7d8 /testsuite/tests/codeGen | |
parent | ed94d3450cbb6ec7a31d9aa37efb7fe93d0559cf (diff) | |
download | haskell-be05bd8168b0ea65d63dc0093a5c8781a2528500.tar.gz |
asm-emit-time IND_STATIC elimination
When a new closure identifier is being established to a
local or exported closure already emitted into the same
module, refrain from adding an IND_STATIC closure, and
instead emit an assembly-language alias.
Inter-module IND_STATIC objects still remain, and need to be
addressed by other measures.
Binary-size savings on nofib are around 0.1%.
Diffstat (limited to 'testsuite/tests/codeGen')
5 files changed, 35 insertions, 1 deletions
diff --git a/testsuite/tests/codeGen/should_compile/Makefile b/testsuite/tests/codeGen/should_compile/Makefile index c0729443c9..8aa7917751 100644 --- a/testsuite/tests/codeGen/should_compile/Makefile +++ b/testsuite/tests/codeGen/should_compile/Makefile @@ -43,3 +43,18 @@ T15723: '$(TEST_HC)' $(TEST_HC_OPTS) -prof -fPIC -fexternal-dynamic-refs -fforce-recomp -O2 -c T15723A.hs -o T15723A.o '$(TEST_HC)' $(TEST_HC_OPTS) -prof -fPIC -fexternal-dynamic-refs -fforce-recomp -O2 -c T15723B.hs -o T15723B.o '$(TEST_HC)' $(TEST_HC_OPTS) -dynamic -shared T15723B.o -o T15723B.so + +## check that there are two assembly equates +# mentioning T15155.a_closure (def and use) +T15155: + '$(TEST_HC)' $(TEST_HC_OPTS) -c -O0 -ddump-asm T15155l.hs | grep -F ".equiv " \ + | grep -F "T15155.a_closure" | wc -l | sed -e 's/ *//g' | grep "2" ; echo $$? + +## check that there are two "$def" aliases: +# - one that bitcasts to %T15155_a_closure_struct* +# - and the other which bitcasts from %T15155_a_closure_struct* +## +T15155l: + '$(TEST_HC)' $(TEST_HC_OPTS) -c -O0 -ddump-llvm T15155l.hs 2>/dev/null \ + | grep -F "= alias %T15155_" | grep -E "@T15155_[ab]_closure.def = " | grep -F "%T15155_a_closure_struct*" \ + | wc -l | sed -e 's/ *//g' | grep "2"; echo $$? diff --git a/testsuite/tests/codeGen/should_compile/T15155.stdout b/testsuite/tests/codeGen/should_compile/T15155.stdout new file mode 100644 index 0000000000..389e262145 --- /dev/null +++ b/testsuite/tests/codeGen/should_compile/T15155.stdout @@ -0,0 +1,2 @@ +2 +0 diff --git a/testsuite/tests/codeGen/should_compile/T15155l.hs b/testsuite/tests/codeGen/should_compile/T15155l.hs new file mode 100644 index 0000000000..643610bc06 --- /dev/null +++ b/testsuite/tests/codeGen/should_compile/T15155l.hs @@ -0,0 +1,8 @@ +module T15155 (a, B(..), b) where + +newtype A = A Int +newtype B = B A + +{-# NOINLINE a #-} +a = A 42 +b = B a diff --git a/testsuite/tests/codeGen/should_compile/T15155l.stdout b/testsuite/tests/codeGen/should_compile/T15155l.stdout new file mode 100644 index 0000000000..389e262145 --- /dev/null +++ b/testsuite/tests/codeGen/should_compile/T15155l.stdout @@ -0,0 +1,2 @@ +2 +0 diff --git a/testsuite/tests/codeGen/should_compile/all.T b/testsuite/tests/codeGen/should_compile/all.T index 45924efc33..547814a0d6 100644 --- a/testsuite/tests/codeGen/should_compile/all.T +++ b/testsuite/tests/codeGen/should_compile/all.T @@ -44,7 +44,7 @@ test('T14999', # Verify that we optimize away redundant jumps for unordered comparisons. test('T15196', - [ unless(arch('x86_64'),skip), + [ unless(arch('x86_64'), skip), only_ways('normal'), ], makefile_test, []) @@ -52,3 +52,10 @@ test('T15723', [ unless(have_profiling(), skip), unless(have_dynamic(), skip), ], makefile_test, []) + +test('T15155', + [ unless(have_ncg(), skip) + ], makefile_test, []) + +test('T15155l', when(unregisterised(), skip), + makefile_test, []) |