Block auto increment on frame pointer references. This is never
beneficial since the SFP expands into SP+C or FP+C during register
allocation. The generated code for the testcase is now as expected:
str x30, [sp, -32]!
strb w0, [sp, 31]
add x0, sp, 31
bl foo3
ldr x30, [sp], 32
ret
gcc/
PR middle-end/46932
* auto-inc-dec.c (parse_add_or_inc): Block autoinc on sfp.
gcc/testsuite/
PR middle-end/46932
* gcc.dg/pr46932.c: New testcase.
From-SVN: r250564
+2017-07-26 Wilco Dijkstra <wdijkstr@arm.com>
+
+ PR middle-end/46932
+ * auto-inc-dec.c (parse_add_or_inc): Block autoinc on sfp.
+
2017-07-26 Martin Liska <mliska@suse.cz>
PR sanitize/81186
inc_insn.pat = pat;
inc_insn.reg_res = SET_DEST (pat);
inc_insn.reg0 = XEXP (SET_SRC (pat), 0);
+
+ /* Block any auto increment of the frame pointer since it expands into
+ an addition and cannot be removed by copy propagation. */
+ if (inc_insn.reg0 == frame_pointer_rtx)
+ return false;
+
if (rtx_equal_p (inc_insn.reg_res, inc_insn.reg0))
inc_insn.form = before_mem ? FORM_PRE_INC : FORM_POST_INC;
else
+2017-07-26 Wilco Dijkstra <wdijkstr@arm.com>
+
+ PR middle-end/46932
+ * gcc.dg/pr46932.c: New testcase.
+
2017-07-26 Martin Liska <mliska@suse.cz>
PR sanitize/81186
--- /dev/null
+/* { dg-options "-O2 -fdump-rtl-auto_inc_dec" } */
+
+/* Check that accesses based on the frame pointer do not
+ use auto increment. */
+
+extern void foo(char*);
+void t01(char t)
+{
+ char c = t;
+ foo(&c);
+}
+
+/* { dg-final { scan-rtl-dump-not "success" "auto_inc_dec" } } */