This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, MIPS] Don't use alias set 0 for register save area


I just noticed it today that a memory expression to the register save
area is assigned to alias set 0.  This of course makes it likely to
conflict with other memory accesses.

Just like other targets I think we should use gen_frame_mem to create
memory references to the save-restore area.

Tested on mipsisa64-elf.

The change fixes g++.dg/vect/param-max-aliased-pr26197.cc, an
interesting testcase.  Note that the loop in the constructor overruns
the array.  When inlined into bar the unrolled loop overwrites the
register save area on the stack.  Flow notices that this makes one of
the stores of a call-saved register dead and ICEs with: Attempt to
delete prologue/epilogue insn.

Now since the prologue insn ends up using a different alias set, flow
no longer attempts to remove the insn.  I tried it for a while to find
a different testcase that would produce the same situation after the
fix but I couldn't so I believe the issue is gone.

Also note that the above behavior is probably due to a typo in the
testcase.  At least the original version from PR 26197 does not seem
to have this problem.

OK to install?

Adam

	* config/mips/mips.c (mips_save_restore_reg): Use reg_frame_mem to
	avoid alias set 0.

Index: mips.c
===================================================================
--- mips.c	(revision 117539)
+++ mips.c	(working copy)
@@ -6521,7 +6521,7 @@ mips_save_restore_reg (enum machine_mode
 {
   rtx mem;
 
-  mem = gen_rtx_MEM (mode, plus_constant (stack_pointer_rtx, offset));
+  mem = gen_frame_mem (mode, plus_constant (stack_pointer_rtx, offset));
 
   fn (gen_rtx_REG (mode, regno), mem);
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]