+2020-04-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/94516
+ * postreload.c: Include rtl-iter.h.
+ (reload_cse_move2add): Handle SP autoinc here by FOR_EACH_SUBRTX_VAR
+ looking for all MEMs with RTX_AUTOINC operand.
+ (move2add_note_store): Remove {PRE,POST}_{INC,DEC} handling.
+
2020-04-08 Tobias Burnus <tobias@codesourcery.com>
* omp-grid.c (grid_eliminate_combined_simd_part): Use
#include "tree-pass.h"
#include "dbgcnt.h"
#include "function-abi.h"
+#include "rtl-iter.h"
static int reload_cse_noop_set_p (rtx);
static bool reload_cse_simplify (rtx_insn *, rtx);
}
}
}
+
+ /* There are no REG_INC notes for SP autoinc. */
+ subrtx_var_iterator::array_type array;
+ FOR_EACH_SUBRTX_VAR (iter, array, PATTERN (insn), NONCONST)
+ {
+ rtx mem = *iter;
+ if (mem
+ && MEM_P (mem)
+ && GET_RTX_CLASS (GET_CODE (XEXP (mem, 0))) == RTX_AUTOINC)
+ {
+ if (XEXP (XEXP (mem, 0), 0) == stack_pointer_rtx)
+ reg_mode[STACK_POINTER_REGNUM] = VOIDmode;
+ }
+ }
+
note_stores (insn, move2add_note_store, insn);
/* If INSN is a conditional branch, we try to extract an
unsigned int regno = 0;
scalar_int_mode mode;
- /* Some targets do argument pushes without adding REG_INC notes. */
-
- if (MEM_P (dst))
- {
- dst = XEXP (dst, 0);
- if (GET_CODE (dst) == PRE_INC || GET_CODE (dst) == POST_INC
- || GET_CODE (dst) == PRE_DEC || GET_CODE (dst) == POST_DEC)
- reg_mode[REGNO (XEXP (dst, 0))] = VOIDmode;
- return;
- }
-
if (GET_CODE (dst) == SUBREG)
regno = subreg_regno (dst);
else if (REG_P (dst))
+2020-04-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR rtl-optimization/94516
+ * gcc.dg/torture/pr94516.c: New test.
+
2020-04-08 Tobias Burnus <tobias@codesourcery.com>
PR middle-end/94120
--- /dev/null
+/* PR rtl-optimization/94516 */
+/* { dg-do run } */
+/* { dg-additional-options "-fpie" { target pie } } */
+
+struct S { unsigned char *a; unsigned int b; };
+typedef int V __attribute__((vector_size (sizeof (int) * 4)));
+
+__attribute__((noipa)) void
+foo (const char *a, const char *b, const char *c, const struct S *d, int e, int f, int g, int h, int i)
+{
+ V v = { 1, 2, 3, 4 };
+ asm volatile ("" : : "g" (&v) : "memory");
+ v += (V) { 5, 6, 7, 8 };
+ asm volatile ("" : : "g" (&v) : "memory");
+}
+
+__attribute__((noipa)) void
+bar (void)
+{
+ const struct S s = { "foobarbaz", 9 };
+ foo ("foo", (const char *) 0, "corge", &s, 0, 1, 0, -12, -31);
+ foo ("bar", "quux", "qux", &s, 0, 0, 9, 0, 0);
+ foo ("baz", (const char *) 0, "qux", &s, 1, 0, 0, -12, -32);
+}
+
+int
+main ()
+{
+ bar ();
+ return 0;
+}