[v3,5/8] Add a bit more logging scheduler's dependency analysis
Commit Message
gcc/ChangeLog:
* sched-deps.cc (sd_add_dep, find_inc): Add logging about
dependency creation.
---
gcc/sched-deps.cc | 30 ++++++++++++++++++++++++++----
1 file changed, 26 insertions(+), 4 deletions(-)
Comments
Dear scheduler maintainers,
Gentle ping. This is a trivial patch, which makes debugging sched-deps.cc
slightly more enjoyable.
On Wed, 22 Nov 2023 at 15:14, Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org>
wrote:
> gcc/ChangeLog:
>
> * sched-deps.cc (sd_add_dep, find_inc): Add logging about
> dependency creation.
> ---
> gcc/sched-deps.cc | 30 ++++++++++++++++++++++++++----
> 1 file changed, 26 insertions(+), 4 deletions(-)
>
> diff --git a/gcc/sched-deps.cc b/gcc/sched-deps.cc
> index 4d357079a7a..2a87158ba4b 100644
> --- a/gcc/sched-deps.cc
> +++ b/gcc/sched-deps.cc
> @@ -1342,6 +1342,13 @@ sd_add_dep (dep_t dep, bool resolved_p)
> in the bitmap caches of dependency information. */
> if (true_dependency_cache != NULL)
> set_dependency_caches (dep);
> +
> + if (sched_verbose >= 9)
> + {
> + fprintf (sched_dump, "created dependency ");
> + dump_dep (sched_dump, dep, 1);
> + fprintf (sched_dump, "\n");
> + }
> }
>
> /* Add or update backward dependence between INSN and ELEM
> @@ -4879,18 +4886,33 @@ find_inc (struct mem_inc_info *mii, bool backwards)
> we create. */
> gcc_assert (mii->inc_insn == inc_cand);
>
> + int n_deps_created = 0;
> if (backwards)
> {
> FOR_EACH_DEP (mii->inc_insn, SD_LIST_BACK, sd_it, dep)
> - add_dependence_1 (mii->mem_insn, DEP_PRO (dep),
> - REG_DEP_TRUE);
> + {
> + add_dependence_1 (mii->mem_insn, DEP_PRO (dep),
> + REG_DEP_TRUE);
> + ++n_deps_created;
> + }
> }
> else
> {
> FOR_EACH_DEP (mii->inc_insn, SD_LIST_FORW, sd_it, dep)
> - add_dependence_1 (DEP_CON (dep), mii->mem_insn,
> - REG_DEP_ANTI);
> + {
> + add_dependence_1 (DEP_CON (dep), mii->mem_insn,
> + REG_DEP_ANTI);
> + ++n_deps_created;
> + }
> }
> + if (sched_verbose >= 6)
> + fprintf (sched_dump,
> + "created %d deps for mem_insn %d due to "
> + "inc_insn %d %s deps\n",
> + n_deps_created, INSN_UID (mii->mem_insn),
> + INSN_UID (mii->inc_insn),
> + backwards ? "backward" : "forward");
> +
> return true;
> }
> next:
> --
> 2.34.1
>
>
@@ -1342,6 +1342,13 @@ sd_add_dep (dep_t dep, bool resolved_p)
in the bitmap caches of dependency information. */
if (true_dependency_cache != NULL)
set_dependency_caches (dep);
+
+ if (sched_verbose >= 9)
+ {
+ fprintf (sched_dump, "created dependency ");
+ dump_dep (sched_dump, dep, 1);
+ fprintf (sched_dump, "\n");
+ }
}
/* Add or update backward dependence between INSN and ELEM
@@ -4879,18 +4886,33 @@ find_inc (struct mem_inc_info *mii, bool backwards)
we create. */
gcc_assert (mii->inc_insn == inc_cand);
+ int n_deps_created = 0;
if (backwards)
{
FOR_EACH_DEP (mii->inc_insn, SD_LIST_BACK, sd_it, dep)
- add_dependence_1 (mii->mem_insn, DEP_PRO (dep),
- REG_DEP_TRUE);
+ {
+ add_dependence_1 (mii->mem_insn, DEP_PRO (dep),
+ REG_DEP_TRUE);
+ ++n_deps_created;
+ }
}
else
{
FOR_EACH_DEP (mii->inc_insn, SD_LIST_FORW, sd_it, dep)
- add_dependence_1 (DEP_CON (dep), mii->mem_insn,
- REG_DEP_ANTI);
+ {
+ add_dependence_1 (DEP_CON (dep), mii->mem_insn,
+ REG_DEP_ANTI);
+ ++n_deps_created;
+ }
}
+ if (sched_verbose >= 6)
+ fprintf (sched_dump,
+ "created %d deps for mem_insn %d due to "
+ "inc_insn %d %s deps\n",
+ n_deps_created, INSN_UID (mii->mem_insn),
+ INSN_UID (mii->inc_insn),
+ backwards ? "backward" : "forward");
+
return true;
}
next: