diff options
author | marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-10-16 11:01:28 +0000 |
---|---|---|
committer | marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-10-16 11:01:28 +0000 |
commit | 343d6f412f4b1b91cdde5d666bd3c6b82cc72fa6 (patch) | |
tree | 4fc9f6523c11cc2d3016b900acbd91480fcac7a7 /gcc/testsuite/g++.dg | |
parent | b0fa59a967d603a02495f2c0a3db9a894e1dddba (diff) | |
download | gcc-343d6f412f4b1b91cdde5d666bd3c6b82cc72fa6.tar.gz |
IPA ICF pass, part 5/5
* g++.dg/ipa/ipa-icf-1.C: New test.
* g++.dg/ipa/ipa-icf-2.C: New test.
* g++.dg/ipa/ipa-icf-3.C: New test.
* g++.dg/ipa/ipa-icf-4.C: New test.
* g++.dg/ipa/ipa-icf-5.C: New test.
* gcc.dg/ipa/ipa-icf-1.c: New test.
* gcc.dg/ipa/ipa-icf-10.c: New test.
* gcc.dg/ipa/ipa-icf-11.c: New test.
* gcc.dg/ipa/ipa-icf-12.c: New test.
* gcc.dg/ipa/ipa-icf-13.c: New test.
* gcc.dg/ipa/ipa-icf-14.c: New test.
* gcc.dg/ipa/ipa-icf-15.c: New test.
* gcc.dg/ipa/ipa-icf-16.c: New test.
* gcc.dg/ipa/ipa-icf-17.c: New test.
* gcc.dg/ipa/ipa-icf-18.c: New test.
* gcc.dg/ipa/ipa-icf-19.c: New test.
* gcc.dg/ipa/ipa-icf-2.c: New test.
* gcc.dg/ipa/ipa-icf-20.c: New test.
* gcc.dg/ipa/ipa-icf-21.c: New test.
* gcc.dg/ipa/ipa-icf-22.c: New test.
* gcc.dg/ipa/ipa-icf-23.c: New test.
* gcc.dg/ipa/ipa-icf-24.c: New test.
* gcc.dg/ipa/ipa-icf-25.c: New test.
* gcc.dg/ipa/ipa-icf-26.c: New test.
* gcc.dg/ipa/ipa-icf-27.c: New test.
* gcc.dg/ipa/ipa-icf-28.c: New test.
* gcc.dg/ipa/ipa-icf-29.c: New test.
* gcc.dg/ipa/ipa-icf-3.c: New test.
* gcc.dg/ipa/ipa-icf-30.c: New test.
* gcc.dg/ipa/ipa-icf-4.c: New test.
* gcc.dg/ipa/ipa-icf-5.c: New test.
* gcc.dg/ipa/ipa-icf-6.c: New test.
* gcc.dg/ipa/ipa-icf-7.c: New test.
* gcc.dg/ipa/ipa-icf-8.c: New test.
* gcc.dg/ipa/ipa-icf-9.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@216308 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/g++.dg')
-rw-r--r-- | gcc/testsuite/g++.dg/ipa/ipa-icf-1.C | 43 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ipa/ipa-icf-2.C | 40 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ipa/ipa-icf-3.C | 36 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ipa/ipa-icf-4.C | 48 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ipa/ipa-icf-5.C | 24 |
5 files changed, 191 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/ipa/ipa-icf-1.C b/gcc/testsuite/g++.dg/ipa/ipa-icf-1.C new file mode 100644 index 00000000000..d27abf47a29 --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/ipa-icf-1.C @@ -0,0 +1,43 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-ipa-icf" } */ + +class A +{ +public: + __attribute__ ((noinline)) + virtual int Foo2() + { + return v; + } + + float f; + int v; +}; + +class B +{ +public: + __attribute__ ((noinline)) + int Bar2() + { + return v; + } + + float f, aaa; + int v; +}; + +int main() +{ + A a; + B b; + + a.Foo2(); + b.Bar2(); + + return 12345; +} + +/* { dg-final { scan-ipa-dump-not "Semantic equality hit:" "icf" } } */ +/* { dg-final { scan-ipa-dump "Equal symbols: 0" "icf" } } */ +/* { dg-final { cleanup-ipa-dump "icf" } } */ diff --git a/gcc/testsuite/g++.dg/ipa/ipa-icf-2.C b/gcc/testsuite/g++.dg/ipa/ipa-icf-2.C new file mode 100644 index 00000000000..48badd740f3 --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/ipa-icf-2.C @@ -0,0 +1,40 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-ipa-icf" } */ + +class A +{ +public: + __attribute__ ((noinline)) + int Foo2() + { + return 1; + } + + int v; + float f; +}; + +class B +{ +public: + __attribute__ ((noinline)) + int Bar2() + { + return 1; + } + + int v; + float f, aaa; +}; + +int main() +{ + A a; + B b; + + return a.Foo2() + b.Bar2(); +} + +/* { dg-final { scan-ipa-dump "Semantic equality hit:" "icf" } } */ +/* { dg-final { scan-ipa-dump "Equal symbols: 1" "icf" } } */ +/* { dg-final { cleanup-ipa-dump "icf" } } */ diff --git a/gcc/testsuite/g++.dg/ipa/ipa-icf-3.C b/gcc/testsuite/g++.dg/ipa/ipa-icf-3.C new file mode 100644 index 00000000000..042f789f669 --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/ipa-icf-3.C @@ -0,0 +1,36 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-ipa-icf" } */ + +__attribute__ ((noinline)) +int zero() +{ + return 0; +} + +__attribute__ ((noinline)) +int nula() +{ + return 0; +} + +__attribute__ ((noinline)) +int foo() +{ + return zero(); +} + +__attribute__ ((noinline)) +int bar() +{ + return nula(); +} + +int main() +{ + return foo() + bar(); +} + +/* { dg-final { scan-ipa-dump "Semantic equality hit:.*bar.*->.*foo.*" "icf" } } */ +/* { dg-final { scan-ipa-dump "Semantic equality hit:.*nula.*->.*zero.*" "icf" } } */ +/* { dg-final { scan-ipa-dump "Equal symbols: 2" "icf" } } */ +/* { dg-final { cleanup-ipa-dump "icf" } } */ diff --git a/gcc/testsuite/g++.dg/ipa/ipa-icf-4.C b/gcc/testsuite/g++.dg/ipa/ipa-icf-4.C new file mode 100644 index 00000000000..9d178893341 --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/ipa-icf-4.C @@ -0,0 +1,48 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-ipa-icf -fno-inline" } */ + +namespace { +struct A +{ + virtual void foo(void) {} +}; +struct B: virtual A +{ + virtual void foo(void) {} +}; +struct C: virtual A +{ + virtual void bar(void) {} +}; +struct D: virtual A +{ + virtual void sparta(void) {} +}; +struct E: B,C,D +{ + virtual void foo(void) {} + virtual void barbar(void) {} +}; +} // anonymous namespace + +int main() +{ + struct A a; + struct B b; + struct C c; + struct D d; + struct E e; + + a.foo(); + b.foo(); + c.bar(); + d.foo(); + d.sparta(); + e.barbar(); + + return 123; +} + +/* { dg-final { scan-ipa-dump "Varpool alias has been created" "icf" } } */ +/* { dg-final { scan-ipa-dump "Equal symbols: 2" "icf" } } */ +/* { dg-final { cleanup-ipa-dump "icf" } } */ diff --git a/gcc/testsuite/g++.dg/ipa/ipa-icf-5.C b/gcc/testsuite/g++.dg/ipa/ipa-icf-5.C new file mode 100644 index 00000000000..728df20a390 --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/ipa-icf-5.C @@ -0,0 +1,24 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-ipa-icf" } */ + +struct test +{ + int a; + float b; +}; + +extern const struct test myarray __attribute__ ((visibility("hidden"))); +extern const struct test myarray_alias __attribute__ ((visibility("hidden"))); + +const struct test myarray = {1, 1.5f}; + +extern const struct test myarray_alias __attribute__ ((alias ("myarray"))); + +int main() +{ + return myarray.a - myarray_alias.a; +} + +/* { dg-final { scan-ipa-dump "Varpool alias cannot be created \\(alias cycle\\)." "icf" } } */ +/* { dg-final { scan-ipa-dump "Equal symbols: 1" "icf" } } */ +/* { dg-final { cleanup-ipa-dump "icf" } } */ |