* [PATCH] Fix cleanup_auto_inc_dec on x86 (PR rtl-optimization/88416)
@ 2018-12-11 16:44 Jakub Jelinek
2018-12-13 18:53 ` Jeff Law
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2018-12-11 16:44 UTC (permalink / raw)
To: Richard Biener, Jeff Law, Alexandre Oliva; +Cc: gcc-patches
Hi!
As mentioned in the PR, x86 (maybe a couple of other targets) isn't an
AUTO_INC_DEC target, it doesn't have REG_INC notes nor wants the generic
code to synthetize any pre/post inc/dec/modify, but does support push/pop
patterns that use those RTL codes.
If unlucky enough, as on the following testcase, we can end up with trying
to propagate such pre/post inc/dec into a DEBUG_INSN, which is invalid.
As cleanup_auto_inc_dec calls copy_rtx which is pretty much the same
function as cleanup_auto_inc_dec in the way how it performs deep copy of the
RTX, except that cleanup_auto_inc_dec also handles the pre/post
inc/dec/modify, I think the easiest fix is just to remove the special case,
it shouldn't make it any slower on !AUTO_INC_DEC targets.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
2018-12-11 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/88416
* valtrack.c (cleanup_auto_inc_dec): Handle pre/post-inc/dec/modify
even if !AUTO_INC_DEC.
* gcc.target/i386/pr88416.c: New test.
--- gcc/valtrack.c.jj 2018-01-04 00:43:16.100702765 +0100
+++ gcc/valtrack.c 2018-12-11 15:39:05.746898166 +0100
@@ -56,8 +56,6 @@ static rtx
cleanup_auto_inc_dec (rtx src, machine_mode mem_mode ATTRIBUTE_UNUSED)
{
rtx x = src;
- if (!AUTO_INC_DEC)
- return copy_rtx (x);
const RTX_CODE code = GET_CODE (x);
int i;
--- gcc/testsuite/gcc.target/i386/pr88416.c.jj 2018-12-11 15:41:44.552308649 +0100
+++ gcc/testsuite/gcc.target/i386/pr88416.c 2018-12-11 15:41:36.977432165 +0100
@@ -0,0 +1,5 @@
+/* PR rtl-optimization/88416 */
+/* { dg-do compile } */
+/* { dg-options "-O1 -fvar-tracking-assignments -fno-forward-propagate --param max-cse-insns=1" } */
+
+#include "writeeflags-1.c"
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix cleanup_auto_inc_dec on x86 (PR rtl-optimization/88416)
2018-12-11 16:44 [PATCH] Fix cleanup_auto_inc_dec on x86 (PR rtl-optimization/88416) Jakub Jelinek
@ 2018-12-13 18:53 ` Jeff Law
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2018-12-13 18:53 UTC (permalink / raw)
To: Jakub Jelinek, Richard Biener, Alexandre Oliva; +Cc: gcc-patches
On 12/11/18 9:43 AM, Jakub Jelinek wrote:
> Hi!
>
> As mentioned in the PR, x86 (maybe a couple of other targets) isn't an
> AUTO_INC_DEC target, it doesn't have REG_INC notes nor wants the generic
> code to synthetize any pre/post inc/dec/modify, but does support push/pop
> patterns that use those RTL codes.
>
> If unlucky enough, as on the following testcase, we can end up with trying
> to propagate such pre/post inc/dec into a DEBUG_INSN, which is invalid.
>
> As cleanup_auto_inc_dec calls copy_rtx which is pretty much the same
> function as cleanup_auto_inc_dec in the way how it performs deep copy of the
> RTX, except that cleanup_auto_inc_dec also handles the pre/post
> inc/dec/modify, I think the easiest fix is just to remove the special case,
> it shouldn't make it any slower on !AUTO_INC_DEC targets.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2018-12-11 Jakub Jelinek <jakub@redhat.com>
>
> PR rtl-optimization/88416
> * valtrack.c (cleanup_auto_inc_dec): Handle pre/post-inc/dec/modify
> even if !AUTO_INC_DEC.
>
> * gcc.target/i386/pr88416.c: New test.
OK
jeff
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-12-13 18:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-11 16:44 [PATCH] Fix cleanup_auto_inc_dec on x86 (PR rtl-optimization/88416) Jakub Jelinek
2018-12-13 18:53 ` Jeff Law
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).