* [PATCH] Fix RTL sharing bug (PR rtl-optimization/80903)
@ 2017-06-02 7:14 Jakub Jelinek
2017-06-02 7:47 ` Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2017-06-02 7:14 UTC (permalink / raw)
To: Richard Biener; +Cc: gcc-patches
Hi!
As has been mentioned earlier, when the doloop code uses the expander after
expansion, we need to unshare stuff because the expander relies on unsharing
being done after it.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
2017-06-02 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/80903
* loop-doloop.c (add_test): Unshare sequence.
* gcc.dg/pr80903.c: New test.
--- gcc/loop-doloop.c.jj 2017-03-24 14:36:35.000000000 +0100
+++ gcc/loop-doloop.c 2017-05-29 12:40:39.062107631 +0200
@@ -367,6 +367,7 @@ add_test (rtx cond, edge *e, basic_block
}
seq = get_insns ();
+ unshare_all_rtl_in_chain (seq);
end_sequence ();
/* There always is at least the jump insn in the sequence. */
--- gcc/testsuite/gcc.dg/pr80903.c.jj 2017-05-29 12:40:27.988242239 +0200
+++ gcc/testsuite/gcc.dg/pr80903.c 2017-05-29 12:37:39.000000000 +0200
@@ -0,0 +1,34 @@
+/* PR rtl-optimization/80903 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -funroll-loops" } */
+
+short int a;
+
+void
+foo (int x, short int y, short int z)
+{
+ if (y != 0)
+ {
+ const short int b = 37;
+ y = 0;
+ while (y < b)
+ {
+ while (y < b)
+ {
+ lab:
+ ++y;
+ }
+ for (y = 0; y < b - 1; ++y)
+ ;
+ if (z != 0)
+ {
+ --a;
+ y *= a;
+ }
+ z = x;
+ }
+ x = 0;
+ }
+
+ goto lab;
+}
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix RTL sharing bug (PR rtl-optimization/80903)
2017-06-02 7:14 [PATCH] Fix RTL sharing bug (PR rtl-optimization/80903) Jakub Jelinek
@ 2017-06-02 7:47 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2017-06-02 7:47 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: gcc-patches
On Fri, 2 Jun 2017, Jakub Jelinek wrote:
> Hi!
>
> As has been mentioned earlier, when the doloop code uses the expander after
> expansion, we need to unshare stuff because the expander relies on unsharing
> being done after it.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
Ok.
Richard.
> 2017-06-02 Jakub Jelinek <jakub@redhat.com>
>
> PR rtl-optimization/80903
> * loop-doloop.c (add_test): Unshare sequence.
>
> * gcc.dg/pr80903.c: New test.
>
> --- gcc/loop-doloop.c.jj 2017-03-24 14:36:35.000000000 +0100
> +++ gcc/loop-doloop.c 2017-05-29 12:40:39.062107631 +0200
> @@ -367,6 +367,7 @@ add_test (rtx cond, edge *e, basic_block
> }
>
> seq = get_insns ();
> + unshare_all_rtl_in_chain (seq);
> end_sequence ();
>
> /* There always is at least the jump insn in the sequence. */
> --- gcc/testsuite/gcc.dg/pr80903.c.jj 2017-05-29 12:40:27.988242239 +0200
> +++ gcc/testsuite/gcc.dg/pr80903.c 2017-05-29 12:37:39.000000000 +0200
> @@ -0,0 +1,34 @@
> +/* PR rtl-optimization/80903 */
> +/* { dg-do compile } */
> +/* { dg-options "-O3 -funroll-loops" } */
> +
> +short int a;
> +
> +void
> +foo (int x, short int y, short int z)
> +{
> + if (y != 0)
> + {
> + const short int b = 37;
> + y = 0;
> + while (y < b)
> + {
> + while (y < b)
> + {
> + lab:
> + ++y;
> + }
> + for (y = 0; y < b - 1; ++y)
> + ;
> + if (z != 0)
> + {
> + --a;
> + y *= a;
> + }
> + z = x;
> + }
> + x = 0;
> + }
> +
> + goto lab;
> +}
>
> 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-06-02 7:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-02 7:14 [PATCH] Fix RTL sharing bug (PR rtl-optimization/80903) Jakub Jelinek
2017-06-02 7: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).