From 5bfd2f9bc61af31a8ada151a6e841b10e37b302c Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 13 Nov 2017 10:01:24 +0100 Subject: [PATCH] re PR tree-optimization/82954 (ICE in fold_binary_loc, at fold-const.c:9061) PR tree-optimization/82954 * gimple-ssa-store-merging.c (imm_store_chain_info::coalesce_immediate_stores): If !infof->ops[N].base_addr, split group if info->ops[N].base_addr. * gcc.c-torture/execute/pr82954.c: New test. From-SVN: r254671 --- gcc/ChangeLog | 7 ++++++ gcc/gimple-ssa-store-merging.c | 10 +++++---- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.c-torture/execute/pr82954.c | 22 +++++++++++++++++++ 4 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr82954.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index dce8e02ba80..293f584682f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2017-11-13 Jakub Jelinek + + PR tree-optimization/82954 + * gimple-ssa-store-merging.c + (imm_store_chain_info::coalesce_immediate_stores): If + !infof->ops[N].base_addr, split group if info->ops[N].base_addr. + 2017-11-13 Richard Sandiford * config/aarch64/aarch64-simd.md (aarch64_store_lane0): diff --git a/gcc/gimple-ssa-store-merging.c b/gcc/gimple-ssa-store-merging.c index 40f7c9843f6..54cb86e4cc7 100644 --- a/gcc/gimple-ssa-store-merging.c +++ b/gcc/gimple-ssa-store-merging.c @@ -1198,10 +1198,12 @@ imm_store_chain_info::coalesce_immediate_stores () std::swap (info->ops[0], info->ops[1]); info->ops_swapped_p = true; } - if ((!infof->ops[0].base_addr - || compatible_load_p (merged_store, info, base_addr, 0)) - && (!infof->ops[1].base_addr - || compatible_load_p (merged_store, info, base_addr, 1))) + if ((infof->ops[0].base_addr + ? compatible_load_p (merged_store, info, base_addr, 0) + : !info->ops[0].base_addr) + && (infof->ops[1].base_addr + ? compatible_load_p (merged_store, info, base_addr, 1) + : !info->ops[1].base_addr)) { merged_store->merge_into (info); continue; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4c739572756..fc943c19126 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-11-13 Jakub Jelinek + + PR tree-optimization/82954 + * gcc.c-torture/execute/pr82954.c: New test. + 2017-11-11 Janus Weil PR fortran/82932 diff --git a/gcc/testsuite/gcc.c-torture/execute/pr82954.c b/gcc/testsuite/gcc.c-torture/execute/pr82954.c new file mode 100644 index 00000000000..5ced28544e5 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr82954.c @@ -0,0 +1,22 @@ +/* PR tree-optimization/82954 */ + +__attribute__((noipa)) void +foo (int *__restrict p, int *__restrict q) +{ + p[0] = p[0] ^ 1; + p[1] = p[1] ^ 2; + p[2] = p[2] ^ q[2]; + p[3] = p[3] ^ q[3]; +} + +int +main () +{ + int p[4] = { 16, 32, 64, 128 }; + int q[4] = { 8, 4, 2, 1 }; + asm volatile ("" : : "g" (p), "g" (q) : "memory"); + foo (p, q); + if (p[0] != 17 || p[1] != 34 || p[2] != 66 || p[3] != 129) + __builtin_abort (); + return 0; +} -- 2.30.2