public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/guojiufu/heads/guojiufu-branch)] invert in/out edge for eq cond
@ 2021-06-09 5:27 Jiu Fu Guo
0 siblings, 0 replies; only message in thread
From: Jiu Fu Guo @ 2021-06-09 5:27 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:c3931cdad3686c7283577dcd8681075e85c39bd4
commit c3931cdad3686c7283577dcd8681075e85c39bd4
Author: Jiufu Guo <guojiufu@linux.ibm.com>
Date: Fri Jun 4 14:05:11 2021 +0800
invert in/out edge for eq cond
Diff:
---
gcc/tree-ssa-loop-split.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/gcc/tree-ssa-loop-split.c b/gcc/tree-ssa-loop-split.c
index 44bb8056b5b..9fa339ebb7d 100644
--- a/gcc/tree-ssa-loop-split.c
+++ b/gcc/tree-ssa-loop-split.c
@@ -1719,6 +1719,24 @@ split_ne_loop (struct loop *loop, edge cond_e)
gcond *gc = as_a<gcond *> (last_stmt (cond_e->src));
gcond *dup_gc = as_a<gcond *> (last_stmt (loop2_cond_exit_bb));
+ /* Invert edges for gcond. */
+ if (gimple_cond_code (gc) == EQ_EXPR)
+ {
+ auto invert_edge = [](basic_block bb) {
+ edge out = EDGE_SUCC (bb, 0);
+ edge in = EDGE_SUCC (bb, 1);
+ if (in->flags & EDGE_TRUE_VALUE)
+ std::swap (in, out);
+ in->flags |= EDGE_TRUE_VALUE;
+ in->flags &= ~EDGE_FALSE_VALUE;
+ out->flags |= EDGE_FALSE_VALUE;
+ out->flags &= ~EDGE_TRUE_VALUE;
+ };
+
+ invert_edge (gimple_bb (gc));
+ invert_edge (gimple_bb (dup_gc));
+ }
+
/* Change if (i != n) to LOOP1:if (i > n) and LOOP2:if (i < n) */
bool inv = expr_invariant_in_loop_p (loop, gimple_cond_lhs (gc));
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-06-09 5:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-09 5:27 [gcc(refs/users/guojiufu/heads/guojiufu-branch)] invert in/out edge for eq cond Jiu Fu Guo
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).