From: zhroma@ispras.ru
To: gcc-patches@gcc.gnu.org
Cc: dm@ispras.ru
Cc: Ayal Zaks <ayal.zaks@gmail.com>
Subject: [PATCH 3/9] [SMS] Eliminate redundant edges
Date: Thu, 21 Jul 2011 16:31:00 -0000 [thread overview]
Message-ID: <1311265834-2144-4-git-send-email-zhroma@ispras.ru> (raw)
In-Reply-To: <1311265834-2144-1-git-send-email-zhroma@ispras.ru>
While building a data dependency graph for loop a ddg edge for some pair
of instructions with inter-loop dependency should be created only if
there is no edge for intra-loop dependency between these instructions.
Creating both of edges leads sometimes to the fact that function
generate_reg_moves creates a redundant register renaming, and some
instruction receives wrong register value from previous iteration.
Overall, this gives a miscompilation.
The add_inter_loop_mem_dep(from,to) function is called only when no
inter-loop "from->to" edge exists, but this function sometimes creates
backward "to->from" edges. This patch prevents these backward edges to
be redundant, it allows to create such edge only when there is no
inter-loop one.
2011-07-20 Roman Zhuykov <zhroma@ispras.ru>
* ddg.c (add_intra_loop_mem_dep): Add new parameter (from_index).
Use it to check whether backward edge is redundant.
(build_intra_loop_deps): Update call to add_intra_loop_mem_dep.
---
gcc/ddg.c | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/gcc/ddg.c b/gcc/ddg.c
index 2bb2cc1..5d0a401 100644
--- a/gcc/ddg.c
+++ b/gcc/ddg.c
@@ -418,7 +418,7 @@ add_intra_loop_mem_dep (ddg_ptr g, ddg_node_ptr from, ddg_node_ptr to)
/* Given two nodes, analyze their RTL insns and add inter-loop mem deps
to ddg G. */
static void
-add_inter_loop_mem_dep (ddg_ptr g, ddg_node_ptr from, ddg_node_ptr to)
+add_inter_loop_mem_dep (ddg_ptr g, ddg_node_ptr from, ddg_node_ptr to, int from_index)
{
if (!insns_may_alias_p (from->insn, to->insn))
/* Do not create edge if memory references have disjoint alias sets. */
@@ -442,10 +442,13 @@ add_inter_loop_mem_dep (ddg_ptr g, ddg_node_ptr from, ddg_node_ptr to)
else if (from->cuid != to->cuid)
{
create_ddg_dep_no_link (g, from, to, ANTI_DEP, MEM_DEP, 1);
- if (DEBUG_INSN_P (from->insn) || DEBUG_INSN_P (to->insn))
- create_ddg_dep_no_link (g, to, from, ANTI_DEP, MEM_DEP, 1);
- else
- create_ddg_dep_no_link (g, to, from, TRUE_DEP, MEM_DEP, 1);
+ if (! TEST_BIT (to->successors, from_index))
+ {
+ if (DEBUG_INSN_P (from->insn) || DEBUG_INSN_P (to->insn))
+ create_ddg_dep_no_link (g, to, from, ANTI_DEP, MEM_DEP, 1);
+ else
+ create_ddg_dep_no_link (g, to, from, TRUE_DEP, MEM_DEP, 1);
+ }
}
}
@@ -511,7 +514,7 @@ build_intra_loop_deps (ddg_ptr g)
/* Don't bother calculating inter-loop dep if an intra-loop dep
already exists. */
if (! TEST_BIT (dest_node->successors, j))
- add_inter_loop_mem_dep (g, dest_node, j_node);
+ add_inter_loop_mem_dep (g, dest_node, j_node, i);
/* If -fmodulo-sched-allow-regmoves
is set certain anti-dep edges are not created.
It might be that these anti-dep edges are on the
--
Roman Zhuykov
zhroma@ispras.ru
next prev parent reply other threads:[~2011-07-21 16:31 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-21 16:31 [PATCH 0/9] [RFC] Expand SMS functionality zhroma
2011-07-21 16:31 ` [PATCH 2/9] [doloop] Correct extracting loop exit condition zhroma
2011-07-22 12:22 ` Richard Sandiford
2011-09-30 15:43 ` Roman Zhuykov
2012-02-10 12:00 ` Andrey Belevantsev
2012-02-17 10:49 ` Richard Sandiford
2011-07-21 16:31 ` [PATCH 5/9] [SMS] Support new loop pattern zhroma
2011-07-24 11:06 ` Revital1 Eres
2011-07-26 9:02 ` Richard Sandiford
2011-07-27 17:36 ` Roman Zhuykov
2011-09-30 15:54 ` Roman Zhuykov
2011-10-12 0:48 ` Ayal Zaks
2011-12-07 14:36 ` Roman Zhuykov
2011-12-07 14:42 ` Roman Zhuykov
2011-12-29 15:43 ` Roman Zhuykov
2012-02-10 12:27 ` Roman Zhuykov
2012-03-29 12:37 ` Andrey Belevantsev
2012-03-30 23:21 ` Ayal Zaks
2012-04-10 8:23 ` Andrey Belevantsev
2011-07-21 16:31 ` zhroma [this message]
2011-07-24 10:36 ` [PATCH 3/9] [SMS] Eliminate redundant edges Revital1 Eres
2011-07-21 16:31 ` [PATCH 1/9] [obvious] Minor cleanup zhroma
2011-07-21 16:31 ` [PATCH 6/9] [SMS] Support potentially infinite loop zhroma
2011-07-21 16:37 ` [PATCH 7/9] New assertion zhroma
2011-07-21 16:59 ` [PATCH 8/9] Extend simple_rhs_p zhroma
2011-07-21 17:04 ` [PATCH 4/9] Move the SMS pass earlier zhroma
2011-07-21 17:09 ` [PATCH 9/9] [ARM] Remove artificial doloop_end pattern zhroma
2012-01-04 16:47 ` Richard Earnshaw
2011-09-30 15:37 ` [PATCH 0/9] [RFC] Expand SMS functionality Roman Zhuykov
2011-10-17 14:34 ` Richard Sandiford
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1311265834-2144-4-git-send-email-zhroma@ispras.ru \
--to=zhroma@ispras.ru \
--cc=dm@ispras.ru \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).