Sorry for the slow reply. Senthil Kumar Selvaraj <senthil.theco...@gmail.com> writes: > 2020-08-13 Senthil Kumar Selvaraj <saaa...@gcc.gnu.org> > > gcc/ChangeLog: > > * emit-rtl.c (try_split): Call copy_frame_info_to_split_insn > to split certain RTX_FRAME_RELATED_P insns. > * recog.c (copy_frame_info_to_split_insn): New function. > (peep2_attempt): Split copying of frame related info of > RTX_FRAME_RELATED_P insns into above function and call it. > * recog.h (copy_frame_info_to_split_insn): Declare it. > > diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c > index f9b0e9714d9..3706f0a03fd 100644 > --- a/gcc/emit-rtl.c > +++ b/gcc/emit-rtl.c > @@ -3822,10 +3822,6 @@ try_split (rtx pat, rtx_insn *trial, int last) > int njumps = 0; > rtx_insn *call_insn = NULL; > > - /* We're not good at redistributing frame information. */ > - if (RTX_FRAME_RELATED_P (trial)) > - return trial; > - > if (any_condjump_p (trial) > && (note = find_reg_note (trial, REG_BR_PROB, 0))) > split_branch_probability > @@ -3842,6 +3838,7 @@ try_split (rtx pat, rtx_insn *trial, int last) > if (!seq) > return trial; > > + int split_insn_count = 0; > /* Avoid infinite loop if any insn of the result matches > the original pattern. */ > insn_last = seq; > @@ -3850,11 +3847,25 @@ try_split (rtx pat, rtx_insn *trial, int last) > if (INSN_P (insn_last) > && rtx_equal_p (PATTERN (insn_last), pat)) > return trial; > + split_insn_count++; > if (!NEXT_INSN (insn_last)) > break; > insn_last = NEXT_INSN (insn_last); > } > > + /* We're not good at redistributing frame information if > + the split occurs before reload or if it results in more > + than one insn. */ > + if (RTX_FRAME_RELATED_P (trial)) > + { > + if (!reload_completed || split_insn_count != 1) > + return trial; > + > + rtx_insn *new_insn = seq; > + rtx_insn *old_insn = trial; > + copy_frame_info_to_split_insn (old_insn, new_insn); > + } > + > /* We will be adding the new sequence to the function. The splitters > may have introduced invalid RTL sharing, so unshare the sequence now. > */ > unshare_all_rtl_in_chain (seq); > diff --git a/gcc/recog.c b/gcc/recog.c > index 25f19b1b1cf..e024597f9d7 100644 > --- a/gcc/recog.c > +++ b/gcc/recog.c > @@ -3277,6 +3277,78 @@ peep2_reinit_state (regset live) > COPY_REG_SET (peep2_insn_data[MAX_INSNS_PER_PEEP2].live_before, live); > } > > +/* Copies frame related info of an insn (old_insn) to the single > + insn (new_insn) that was obtained by splitting old_insn. */
By convention, old_insn and new_insn should be in caps, since they refer to parameter names. OK otherwise, thanks. Richard