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
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