Commit 97741c11 by Segher Boessenkool Committed by Segher Boessenkool

regrename: Don't rename the dest of a REG_CFA_REGISTER (PR85645)

We should never change the destination of a REG_CFA_REGISTER, just
like for insns with a REG_CFA_RESTORE, because we need to have the
same control flow information on all branches that join.  It is very
doubtful that renaming the scratch registers used for prologue/epilogue
will help anything either.


	PR rtl-optimization/85645
	* regrename.c (build_def_use): Also kill the chains that include the
	destination of a REG_CFA_REGISTER note.

From-SVN: r260075
parent c35533d7
2018-05-09 Segher Boessenkool <segher@kernel.crashing.org> 2018-05-09 Segher Boessenkool <segher@kernel.crashing.org>
PR rtl-optimization/85645 PR rtl-optimization/85645
* regrename.c (build_def_use): Also kill the chains that include the
destination of a REG_CFA_REGISTER note.
2018-05-09 Segher Boessenkool <segher@kernel.crashing.org>
PR rtl-optimization/85645
* regcprop.c (copyprop_hardreg_forward_1): Don't propagate into an * regcprop.c (copyprop_hardreg_forward_1): Don't propagate into an
insn that has a REG_CFA_REGISTER note. insn that has a REG_CFA_REGISTER note.
......
...@@ -1661,7 +1661,8 @@ build_def_use (basic_block bb) ...@@ -1661,7 +1661,8 @@ build_def_use (basic_block bb)
(6) For any non-earlyclobber write we find in an operand, make (6) For any non-earlyclobber write we find in an operand, make
a new chain or mark the hard register as live. a new chain or mark the hard register as live.
(7) For any REG_UNUSED, close any chains we just opened. (7) For any REG_UNUSED, close any chains we just opened.
(8) For any REG_CFA_RESTORE, kill any chain containing it. (8) For any REG_CFA_RESTORE or REG_CFA_REGISTER, kill any chain
containing its dest.
We cannot deal with situations where we track a reg in one mode We cannot deal with situations where we track a reg in one mode
and see a reference in another mode; these will cause the chain and see a reference in another mode; these will cause the chain
...@@ -1882,10 +1883,20 @@ build_def_use (basic_block bb) ...@@ -1882,10 +1883,20 @@ build_def_use (basic_block bb)
} }
/* Step 8: Kill the chains involving register restores. Those /* Step 8: Kill the chains involving register restores. Those
should restore _that_ register. */ should restore _that_ register. Similar for REG_CFA_REGISTER. */
for (note = REG_NOTES (insn); note; note = XEXP (note, 1)) for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
if (REG_NOTE_KIND (note) == REG_CFA_RESTORE) if (REG_NOTE_KIND (note) == REG_CFA_RESTORE
scan_rtx (insn, &XEXP (note, 0), NO_REGS, mark_all_read, OP_IN); || REG_NOTE_KIND (note) == REG_CFA_REGISTER)
{
rtx *x = &XEXP (note, 0);
if (!*x)
x = &PATTERN (insn);
if (GET_CODE (*x) == PARALLEL)
x = &XVECEXP (*x, 0, 0);
if (GET_CODE (*x) == SET)
x = &SET_DEST (*x);
scan_rtx (insn, x, NO_REGS, mark_all_read, OP_IN);
}
} }
else if (DEBUG_BIND_INSN_P (insn) else if (DEBUG_BIND_INSN_P (insn)
&& !VAR_LOC_UNKNOWN_P (INSN_VAR_LOCATION_LOC (insn))) && !VAR_LOC_UNKNOWN_P (INSN_VAR_LOCATION_LOC (insn)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment