2014-11-17 Vladimir Makarov <vmakarov@redhat.com>
authorvmakarov <vmakarov@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 18 Nov 2014 00:14:25 +0000 (00:14 +0000)
committervmakarov <vmakarov@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 18 Nov 2014 00:14:25 +0000 (00:14 +0000)
PR rtl-optimization/63906
* lra-remat.c (operand_to_remat): Check SP and
frame_pointer_required.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@217683 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/lra-remat.c

index a04b10a..00a567f 100644 (file)
@@ -1,3 +1,9 @@
+2014-11-17  Vladimir Makarov  <vmakarov@redhat.com>
+
+       PR rtl-optimization/63906
+       * lra-remat.c (operand_to_remat): Check SP and
+       frame_pointer_required.
+
 2014-11-17  Mircea Namolaru  <mircea.namolaru@inria.fr>
 
        * doc/invoke.texi (floop-unroll-and-jam): Document
index fcb1b6f..3b8a806 100644 (file)
@@ -399,7 +399,13 @@ operand_to_remat (rtx_insn *insn)
 
   /* First find a pseudo which can be rematerialized.  */
   for (reg = id->regs; reg != NULL; reg = reg->next)
-    if (reg->type == OP_OUT && ! reg->subreg_p
+    /* True FRAME_POINTER_NEEDED might be because we can not follow
+       changing sp offsets, e.g. alloca is used.  If the insn contains
+       stack pointer in such case, we can not rematerialize it as we
+       can not know sp offset at a rematerialization place.  */
+    if (reg->regno == STACK_POINTER_REGNUM && frame_pointer_needed)
+      return -1;
+    else if (reg->type == OP_OUT && ! reg->subreg_p
        && find_regno_note (insn, REG_UNUSED, reg->regno) == NULL)
       {
        /* We permits only one spilled reg.  */