From: Vladimir Makarov Date: Tue, 18 Nov 2014 00:14:25 +0000 (+0000) Subject: re PR rtl-optimization/63906 (lra_remat miscompiles glibc on aarch64) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=daab44bffd8508746a01dcd242a1af592f78b388;p=gcc.git re PR rtl-optimization/63906 (lra_remat miscompiles glibc on aarch64) 2014-11-17 Vladimir Makarov PR rtl-optimization/63906 * lra-remat.c (operand_to_remat): Check SP and frame_pointer_required. From-SVN: r217683 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a04b10a3575..00a567fd58f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-11-17 Vladimir Makarov + + PR rtl-optimization/63906 + * lra-remat.c (operand_to_remat): Check SP and + frame_pointer_required. + 2014-11-17 Mircea Namolaru * doc/invoke.texi (floop-unroll-and-jam): Document diff --git a/gcc/lra-remat.c b/gcc/lra-remat.c index fcb1b6f6097..3b8a8069de9 100644 --- a/gcc/lra-remat.c +++ b/gcc/lra-remat.c @@ -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. */