* [PATCH] Fix recent store-merging ICE (PR tree-optimization/82838)
@ 2017-11-06 6:32 Jakub Jelinek
2017-11-06 8:47 ` Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2017-11-06 6:32 UTC (permalink / raw)
To: Richard Biener; +Cc: gcc-patches
Hi!
force_gimple_operand_1 clears the *seq first and then adds statements
there if any are needed. So calling force_gimple_operand_1 twice on the
same seq is throwing away the earlier statements if any, rather than
appending new statements to those.
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?
2017-11-06 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/82838
* gimple-ssa-store-merging.c
(imm_store_chain_info::output_merged_store): Call force_gimple_operand_1
on a separate gimple_seq which is then appended to seq.
* gcc.c-torture/compile/pr82838.c: New test.
--- gcc/gimple-ssa-store-merging.c.jj 2017-11-04 19:59:28.000000000 +0100
+++ gcc/gimple-ssa-store-merging.c 2017-11-04 22:59:07.410232483 +0100
@@ -1670,10 +1670,14 @@ imm_store_chain_info::output_merged_stor
else if (operand_equal_p (base_addr, op.base_addr, 0))
load_addr[j] = addr;
else
- load_addr[j]
- = force_gimple_operand_1 (unshare_expr (op.base_addr),
- &seq, is_gimple_mem_ref_addr,
- NULL_TREE);
+ {
+ gimple_seq this_seq;
+ load_addr[j]
+ = force_gimple_operand_1 (unshare_expr (op.base_addr),
+ &this_seq, is_gimple_mem_ref_addr,
+ NULL_TREE);
+ gimple_seq_add_seq_without_update (&seq, this_seq);
+ }
}
FOR_EACH_VEC_ELT (split_stores, i, split_store)
--- gcc/testsuite/gcc.c-torture/compile/pr82838.c.jj 2017-11-04 23:02:09.522012666 +0100
+++ gcc/testsuite/gcc.c-torture/compile/pr82838.c 2017-11-04 23:01:54.000000000 +0100
@@ -0,0 +1,12 @@
+/* PR tree-optimization/82838 */
+
+struct S { unsigned short a, b, c; };
+struct S f[10];
+
+void
+foo (int e)
+{
+ struct S *x;
+ f[e].b = x[e].a;
+ f[e].c = x[e].b;
+}
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix recent store-merging ICE (PR tree-optimization/82838)
2017-11-06 6:32 [PATCH] Fix recent store-merging ICE (PR tree-optimization/82838) Jakub Jelinek
@ 2017-11-06 8:47 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2017-11-06 8:47 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: gcc-patches
On Mon, 6 Nov 2017, Jakub Jelinek wrote:
> Hi!
>
> force_gimple_operand_1 clears the *seq first and then adds statements
> there if any are needed. So calling force_gimple_operand_1 twice on the
> same seq is throwing away the earlier statements if any, rather than
> appending new statements to those.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk?
Ok.
Richard.
> 2017-11-06 Jakub Jelinek <jakub@redhat.com>
>
> PR tree-optimization/82838
> * gimple-ssa-store-merging.c
> (imm_store_chain_info::output_merged_store): Call force_gimple_operand_1
> on a separate gimple_seq which is then appended to seq.
>
> * gcc.c-torture/compile/pr82838.c: New test.
>
> --- gcc/gimple-ssa-store-merging.c.jj 2017-11-04 19:59:28.000000000 +0100
> +++ gcc/gimple-ssa-store-merging.c 2017-11-04 22:59:07.410232483 +0100
> @@ -1670,10 +1670,14 @@ imm_store_chain_info::output_merged_stor
> else if (operand_equal_p (base_addr, op.base_addr, 0))
> load_addr[j] = addr;
> else
> - load_addr[j]
> - = force_gimple_operand_1 (unshare_expr (op.base_addr),
> - &seq, is_gimple_mem_ref_addr,
> - NULL_TREE);
> + {
> + gimple_seq this_seq;
> + load_addr[j]
> + = force_gimple_operand_1 (unshare_expr (op.base_addr),
> + &this_seq, is_gimple_mem_ref_addr,
> + NULL_TREE);
> + gimple_seq_add_seq_without_update (&seq, this_seq);
> + }
> }
>
> FOR_EACH_VEC_ELT (split_stores, i, split_store)
> --- gcc/testsuite/gcc.c-torture/compile/pr82838.c.jj 2017-11-04 23:02:09.522012666 +0100
> +++ gcc/testsuite/gcc.c-torture/compile/pr82838.c 2017-11-04 23:01:54.000000000 +0100
> @@ -0,0 +1,12 @@
> +/* PR tree-optimization/82838 */
> +
> +struct S { unsigned short a, b, c; };
> +struct S f[10];
> +
> +void
> +foo (int e)
> +{
> + struct S *x;
> + f[e].b = x[e].a;
> + f[e].c = x[e].b;
> +}
>
> Jakub
>
>
--
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-11-06 8:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-06 6:32 [PATCH] Fix recent store-merging ICE (PR tree-optimization/82838) Jakub Jelinek
2017-11-06 8:47 ` Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).