public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-5150] Resolve entry loop condition for the edge remaining in the loop.
@ 2021-11-11 12:17 Aldy Hernandez
0 siblings, 0 replies; only message in thread
From: Aldy Hernandez @ 2021-11-11 12:17 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:3e5a19053310ad090b930fbecebceb28bd1b91a4
commit r12-5150-g3e5a19053310ad090b930fbecebceb28bd1b91a4
Author: Aldy Hernandez <aldyh@redhat.com>
Date: Thu Nov 11 11:27:07 2021 +0100
Resolve entry loop condition for the edge remaining in the loop.
There is a known failure for gfortran.dg/vector_subscript_1.f90. It
was previously failing for all optimization levels except -Os.
Getting the loop header copying right, now makes it fail for all
levels :-).
Tested on x86-64 Linux.
Co-authored-by: Richard Biener <rguenther@suse.de>
gcc/ChangeLog:
* tree-ssa-loop-ch.c (entry_loop_condition_is_static): Resolve
statically to the edge remaining in the loop.
Diff:
---
gcc/tree-ssa-loop-ch.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/gcc/tree-ssa-loop-ch.c b/gcc/tree-ssa-loop-ch.c
index c7d86d751d4..af3401f112c 100644
--- a/gcc/tree-ssa-loop-ch.c
+++ b/gcc/tree-ssa-loop-ch.c
@@ -57,10 +57,24 @@ entry_loop_condition_is_static (class loop *l, path_range_query *query)
|| !irange::supports_type_p (TREE_TYPE (gimple_cond_lhs (last))))
return false;
+ edge true_e, false_e;
+ extract_true_false_edges_from_block (e->dest, &true_e, &false_e);
+
+ /* If neither edge is the exit edge, this is not a case we'd like to
+ special-case. */
+ if (!loop_exit_edge_p (l, true_e) && !loop_exit_edge_p (l, false_e))
+ return false;
+
+ tree desired_static_value;
+ if (loop_exit_edge_p (l, true_e))
+ desired_static_value = boolean_false_node;
+ else
+ desired_static_value = boolean_true_node;
+
int_range<2> r;
query->compute_ranges (e);
query->range_of_stmt (r, last);
- return r == int_range<2> (boolean_true_node, boolean_true_node);
+ return r == int_range<2> (desired_static_value, desired_static_value);
}
/* Check whether we should duplicate HEADER of LOOP. At most *LIMIT
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-11-11 12:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-11 12:17 [gcc r12-5150] Resolve entry loop condition for the edge remaining in the loop Aldy Hernandez
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).