From: Jakub Jelinek Date: Mon, 13 Nov 2017 09:01:24 +0000 (+0100) Subject: re PR tree-optimization/82954 (ICE in fold_binary_loc, at fold-const.c:9061) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5bfd2f9bc61af31a8ada151a6e841b10e37b302c;p=gcc.git 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 --- 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; +}