Skip to content

Commit 185aa3b

Browse files
committed
fix for jira P10019563-81217
during scheduling (before ira/fusion/after ira) certain conditions that enable fusion (thus sequence ordering) take into account the presence of debug instructions. But debug instructions shouldnt influence instruction order.
1 parent 28fe99f commit 185aa3b

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

gcc/config/riscv/riscv.cc

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10842,7 +10842,8 @@ riscv_sched_reorder2 (FILE *file ATTRIBUTE_UNUSED,
1084210842
int *n_readyp,
1084310843
int clock ATTRIBUTE_UNUSED)
1084410844
{
10845-
if (sched_fusion)
10845+
10846+
if (sched_fusion)
1084610847
return cached_can_issue_more;
1084710848

1084810849
if (!cached_can_issue_more)
@@ -10856,11 +10857,12 @@ riscv_sched_reorder2 (FILE *file ATTRIBUTE_UNUSED,
1085610857
{
1085710858
for (int i = 1; i <= *n_readyp; i++)
1085810859
{
10859-
if (NONDEBUG_INSN_P (ready[*n_readyp - i])
10860-
&& !SCHED_GROUP_P (ready[*n_readyp - i])
10861-
&& (!next_insn (ready[*n_readyp - i])
10862-
|| !NONDEBUG_INSN_P (next_insn (ready[*n_readyp - i]))
10863-
|| !SCHED_GROUP_P (next_insn (ready[*n_readyp - i])))
10860+
/*try to fuse the last_scheduled_insn with */
10861+
if (NONDEBUG_INSN_P (ready[*n_readyp - i]) /*fuse only with nondebug insn*/
10862+
&& !SCHED_GROUP_P (ready[*n_readyp - i]) /*which have not been already fused*/
10863+
&& (!next_nonnote_nondebug_insn (ready[*n_readyp - i]) /* no real insn comes after*/
10864+
/*dont fuse at the expense of breaking another fuse*/
10865+
|| !SCHED_GROUP_P (next_nonnote_nondebug_insn (ready[*n_readyp - i])))
1086410866
&& arcv_macro_fusion_pair_p (last_scheduled_insn, ready[*n_readyp - i]))
1086510867
{
1086610868
std::swap (ready[*n_readyp - 1], ready[*n_readyp - i]);
@@ -10873,8 +10875,7 @@ riscv_sched_reorder2 (FILE *file ATTRIBUTE_UNUSED,
1087310875
}
1087410876

1087510877
/* Try to fuse a non-memory last_scheduled_insn. */
10876-
if ((!alu_pipe_scheduled_p || !pipeB_scheduled_p)
10877-
&& last_scheduled_insn && ready && *n_readyp > 0
10878+
if ((!alu_pipe_scheduled_p || !pipeB_scheduled_p) && last_scheduled_insn && ready && *n_readyp > 0
1087810879
&& !SCHED_GROUP_P (last_scheduled_insn)
1087910880
&& (get_attr_type (last_scheduled_insn) != TYPE_LOAD
1088010881
&& get_attr_type (last_scheduled_insn) != TYPE_STORE))
@@ -10883,10 +10884,9 @@ riscv_sched_reorder2 (FILE *file ATTRIBUTE_UNUSED,
1088310884
{
1088410885
if (NONDEBUG_INSN_P (ready[*n_readyp - i])
1088510886
&& !SCHED_GROUP_P (ready[*n_readyp - i])
10886-
&& (!next_insn (ready[*n_readyp - i])
10887-
|| !NONDEBUG_INSN_P (next_insn (ready[*n_readyp - i]))
10888-
|| !SCHED_GROUP_P (next_insn (ready[*n_readyp - i])))
10889-
&& arcv_macro_fusion_pair_p (last_scheduled_insn, ready[*n_readyp - i]))
10887+
&& (!next_nonnote_nondebug_insn (ready[*n_readyp - i])
10888+
|| !SCHED_GROUP_P (next_nonnote_nondebug_insn (ready[*n_readyp - i])))
10889+
&& arcv_macro_fusion_pair_p (last_scheduled_insn, ready[*n_readyp - i]))
1089010890
{
1089110891
if (get_attr_type (ready[*n_readyp - i]) == TYPE_LOAD
1089210892
|| get_attr_type (ready[*n_readyp - i]) == TYPE_STORE)
@@ -10925,11 +10925,11 @@ riscv_sched_reorder2 (FILE *file ATTRIBUTE_UNUSED,
1092510925
&& get_attr_type (ready[*n_readyp - i]) != TYPE_LOAD
1092610926
&& get_attr_type (ready[*n_readyp - i]) != TYPE_STORE
1092710927
&& !SCHED_GROUP_P (ready[*n_readyp - i])
10928-
&& ((!next_insn (ready[*n_readyp - i])
10929-
|| !NONDEBUG_INSN_P (next_insn (ready[*n_readyp - i]))
10930-
|| !SCHED_GROUP_P (next_insn (ready[*n_readyp - i])))))
10928+
&& (!next_nonnote_nondebug_insn (ready[*n_readyp - i])
10929+
|| !SCHED_GROUP_P (next_nonnote_nondebug_insn (ready[*n_readyp - i])))
10930+
)
1093110931
|| ((next_insn (ready[*n_readyp - i])
10932-
&& NONDEBUG_INSN_P (next_insn (ready[*n_readyp - i]))
10932+
/* && NONDEBUG_INSN_P (next_insn (ready[*n_readyp - i])) */
1093310933
&& recog_memoized (next_insn (ready[*n_readyp - i])) >= 0
1093410934
&& get_attr_type (next_insn (ready[*n_readyp - i])) != TYPE_LOAD
1093510935
&& get_attr_type (next_insn (ready[*n_readyp - i])) != TYPE_STORE)))

0 commit comments

Comments
 (0)