diff options
author | Kyrylo Tkachov <kyrylo.tkachov@arm.com> | 2016-10-28 14:18:50 +0000 |
---|---|---|
committer | Kyrylo Tkachov <ktkachov@gcc.gnu.org> | 2016-10-28 14:18:50 +0000 |
commit | f663d9ad6eaa6ff32676981461e865f96cb7c151 (patch) | |
tree | c6b6f30f38de29c8fcc46fc859446438b55c447f /gcc/testsuite/gcc.c-torture | |
parent | 1f5700e95225d0a95cae2f96c17699c4d133f5e0 (diff) | |
download | gcc-f663d9ad6eaa6ff32676981461e865f96cb7c151.zip gcc-f663d9ad6eaa6ff32676981461e865f96cb7c151.tar.gz gcc-f663d9ad6eaa6ff32676981461e865f96cb7c151.tar.bz2 |
GIMPLE store merging pass
2016-10-28 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
PR middle-end/22141
* Makefile.in (OBJS): Add gimple-ssa-store-merging.o.
* common.opt (fstore-merging): New Optimization option.
* opts.c (default_options_table): Add entry for
OPT_ftree_store_merging.
* fold-const.h (can_native_encode_type_p): Declare prototype.
* fold-const.c (can_native_encode_type_p): Define.
* params.def (PARAM_STORE_MERGING_ALLOW_UNALIGNED): Define.
(PARAM_MAX_STORES_TO_MERGE): Likewise.
* timevar.def (TV_GIMPLE_STORE_MERGING): New timevar.
* passes.def: Insert pass_tree_store_merging.
* tree-pass.h (make_pass_store_merging): Declare extern
prototype.
* gimple-ssa-store-merging.c: New file.
* doc/invoke.texi (Optimization Options): Document
-fstore-merging.
(--param documentation): Document store-merging-allow-unaligned
and max-stores-to-merge.
2016-10-28 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
Jakub Jelinek <jakub@redhat.com>
Andrew Pinski <pinskia@gmail.com>
PR middle-end/22141
PR rtl-optimization/23684
* gcc.c-torture/execute/pr22141-1.c: New test.
* gcc.c-torture/execute/pr22141-2.c: Likewise.
* gcc.target/aarch64/ldp_stp_1.c: Adjust for -fstore-merging.
* gcc.target/aarch64/ldp_stp_4.c: Likewise.
* gcc.dg/store_merging_1.c: New test.
* gcc.dg/store_merging_2.c: Likewise.
* gcc.dg/store_merging_3.c: Likewise.
* gcc.dg/store_merging_4.c: Likewise.
* gcc.dg/store_merging_5.c: Likewise.
* gcc.dg/store_merging_6.c: Likewise.
* gcc.dg/store_merging_7.c: Likewise.
* gcc.target/i386/pr22141.c: Likewise.
* gcc.target/i386/pr34012.c: Add -fno-store-merging to dg-options.
* g++.dg/init/new17.C: Likewise.
Co-Authored-By: Andrew Pinski <pinskia@gmail.com>
Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
From-SVN: r241649
Diffstat (limited to 'gcc/testsuite/gcc.c-torture')
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/pr22141-1.c | 122 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/pr22141-2.c | 122 |
2 files changed, 244 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr22141-1.c b/gcc/testsuite/gcc.c-torture/execute/pr22141-1.c new file mode 100644 index 0000000..7c888b4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr22141-1.c @@ -0,0 +1,122 @@ +/* PR middle-end/22141 */ + +extern void abort (void); + +struct S +{ + struct T + { + char a; + char b; + char c; + char d; + } t; +} u; + +struct U +{ + struct S s[4]; +}; + +void __attribute__((noinline)) +c1 (struct T *p) +{ + if (p->a != 1 || p->b != 2 || p->c != 3 || p->d != 4) + abort (); + __builtin_memset (p, 0xaa, sizeof (*p)); +} + +void __attribute__((noinline)) +c2 (struct S *p) +{ + c1 (&p->t); +} + +void __attribute__((noinline)) +c3 (struct U *p) +{ + c2 (&p->s[2]); +} + +void __attribute__((noinline)) +f1 (void) +{ + u = (struct S) { { 1, 2, 3, 4 } }; +} + +void __attribute__((noinline)) +f2 (void) +{ + u.t.a = 1; + u.t.b = 2; + u.t.c = 3; + u.t.d = 4; +} + +void __attribute__((noinline)) +f3 (void) +{ + u.t.d = 4; + u.t.b = 2; + u.t.a = 1; + u.t.c = 3; +} + +void __attribute__((noinline)) +f4 (void) +{ + struct S v; + v.t.a = 1; + v.t.b = 2; + v.t.c = 3; + v.t.d = 4; + c2 (&v); +} + +void __attribute__((noinline)) +f5 (struct S *p) +{ + p->t.a = 1; + p->t.c = 3; + p->t.d = 4; + p->t.b = 2; +} + +void __attribute__((noinline)) +f6 (void) +{ + struct U v; + v.s[2].t.a = 1; + v.s[2].t.b = 2; + v.s[2].t.c = 3; + v.s[2].t.d = 4; + c3 (&v); +} + +void __attribute__((noinline)) +f7 (struct U *p) +{ + p->s[2].t.a = 1; + p->s[2].t.c = 3; + p->s[2].t.d = 4; + p->s[2].t.b = 2; +} + +int +main (void) +{ + struct U w; + f1 (); + c2 (&u); + f2 (); + c1 (&u.t); + f3 (); + c2 (&u); + f4 (); + f5 (&u); + c2 (&u); + f6 (); + f7 (&w); + c3 (&w); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr22141-2.c b/gcc/testsuite/gcc.c-torture/execute/pr22141-2.c new file mode 100644 index 0000000..cb9cc79 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr22141-2.c @@ -0,0 +1,122 @@ +/* PR middle-end/22141 */ + +extern void abort (void); + +struct S +{ + struct T + { + char a; + char b; + char c; + char d; + } t; +} u __attribute__((aligned)); + +struct U +{ + struct S s[4]; +}; + +void __attribute__((noinline)) +c1 (struct T *p) +{ + if (p->a != 1 || p->b != 2 || p->c != 3 || p->d != 4) + abort (); + __builtin_memset (p, 0xaa, sizeof (*p)); +} + +void __attribute__((noinline)) +c2 (struct S *p) +{ + c1 (&p->t); +} + +void __attribute__((noinline)) +c3 (struct U *p) +{ + c2 (&p->s[2]); +} + +void __attribute__((noinline)) +f1 (void) +{ + u = (struct S) { { 1, 2, 3, 4 } }; +} + +void __attribute__((noinline)) +f2 (void) +{ + u.t.a = 1; + u.t.b = 2; + u.t.c = 3; + u.t.d = 4; +} + +void __attribute__((noinline)) +f3 (void) +{ + u.t.d = 4; + u.t.b = 2; + u.t.a = 1; + u.t.c = 3; +} + +void __attribute__((noinline)) +f4 (void) +{ + struct S v __attribute__((aligned)); + v.t.a = 1; + v.t.b = 2; + v.t.c = 3; + v.t.d = 4; + c2 (&v); +} + +void __attribute__((noinline)) +f5 (struct S *p) +{ + p->t.a = 1; + p->t.c = 3; + p->t.d = 4; + p->t.b = 2; +} + +void __attribute__((noinline)) +f6 (void) +{ + struct U v __attribute__((aligned)); + v.s[2].t.a = 1; + v.s[2].t.b = 2; + v.s[2].t.c = 3; + v.s[2].t.d = 4; + c3 (&v); +} + +void __attribute__((noinline)) +f7 (struct U *p) +{ + p->s[2].t.a = 1; + p->s[2].t.c = 3; + p->s[2].t.d = 4; + p->s[2].t.b = 2; +} + +int +main (void) +{ + struct U w __attribute__((aligned)); + f1 (); + c2 (&u); + f2 (); + c1 (&u.t); + f3 (); + c2 (&u); + f4 (); + f5 (&u); + c2 (&u); + f6 (); + f7 (&w); + c3 (&w); + return 0; +} |