From 43d0b501eec49d6d4092fe0e5299aedf1d743124 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 1 Dec 2016 08:56:49 +0100 Subject: [PATCH] re PR target/78614 (ICE error: invalid rtl sharing found in the insn (verify_rtx_sharing) gcc/emit-rtl.c:2743) PR target/78614 * config/rs6000/rs6000.c (rs6000_frame_related): Call set_used_flags (pat) before any simplifications. Clear used flag on PARALLEL copy. Don't guard add_reg_note call. Call copy_rtx_if_shared on pat before storing it into REG_FRAME_RELATED_EXPR. From-SVN: r243099 --- gcc/ChangeLog | 9 +++++++++ gcc/config/rs6000/rs6000.c | 5 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e36f9d849ff..b3cc6305578 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2016-12-01 Jakub Jelinek + + PR target/78614 + * config/rs6000/rs6000.c (rs6000_frame_related): Call + set_used_flags (pat) before any simplifications. Clear used flag on + PARALLEL copy. Don't guard add_reg_note call. Call + copy_rtx_if_shared on pat before storing it into + REG_FRAME_RELATED_EXPR. + 2016-12-01 Alan Modra * gcc/config/rs6000/rs6000.c (insn_is_swappable_p): Properly diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 7f307b1ff0f..e5726209297 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -27174,6 +27174,7 @@ rs6000_frame_related (rtx_insn *insn, rtx reg, HOST_WIDE_INT val, Call simplify_replace_rtx on the SETs rather than the whole insn so as to leave the other stuff alone (for example USE of r12). */ + set_used_flags (pat); if (GET_CODE (pat) == SET) { if (repl) @@ -27185,6 +27186,7 @@ rs6000_frame_related (rtx_insn *insn, rtx reg, HOST_WIDE_INT val, { pat = shallow_copy_rtx (pat); XVEC (pat, 0) = shallow_copy_rtvec (XVEC (pat, 0)); + RTX_FLAG (pat, used) = 0; for (int i = 0; i < XVECLEN (pat, 0); i++) if (GET_CODE (XVECEXP (pat, 0, i)) == SET) @@ -27207,8 +27209,7 @@ rs6000_frame_related (rtx_insn *insn, rtx reg, HOST_WIDE_INT val, gcc_unreachable (); RTX_FRAME_RELATED_P (insn) = 1; - if (repl || reg2) - add_reg_note (insn, REG_FRAME_RELATED_EXPR, pat); + add_reg_note (insn, REG_FRAME_RELATED_EXPR, copy_rtx_if_shared (pat)); return insn; } -- 2.30.2