aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-loop-manip.cc
diff options
context:
space:
mode:
authorTamar Christina <tamar.christina@arm.com>2023-11-16 12:11:22 +0000
committerTamar Christina <tamar.christina@arm.com>2023-11-16 12:11:55 +0000
commit7a496b7ce105185be12e023e749c90d5f7561879 (patch)
tree60b939cf7ed85a59cd0c8d49fd2375f4fa61c137 /gcc/tree-vect-loop-manip.cc
parentec35fdc9576d3907973667b57932b21514ee5062 (diff)
downloadgcc-7a496b7ce105185be12e023e749c90d5f7561879.zip
gcc-7a496b7ce105185be12e023e749c90d5f7561879.tar.gz
gcc-7a496b7ce105185be12e023e749c90d5f7561879.tar.bz2
middle-end: skip checking loop exits if loop malformed [PR111878]
Before my refactoring if the loop->latch was incorrect then find_loop_location skipped checking the edges and would eventually return a dummy location. It turns out that a loop can have loops_state_satisfies_p (LOOPS_HAVE_RECORDED_EXITS) but also not have a latch in which case get_loop_exit_edges traps. This restores the old behavior. gcc/ChangeLog: PR tree-optimization/111878 * tree-vect-loop-manip.cc (find_loop_location): Skip edges check if latch incorrect. gcc/testsuite/ChangeLog: PR tree-optimization/111878 * gcc.dg/graphite/pr111878.c: New test.
Diffstat (limited to 'gcc/tree-vect-loop-manip.cc')
-rw-r--r--gcc/tree-vect-loop-manip.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc
index b916127..bcd90a3 100644
--- a/gcc/tree-vect-loop-manip.cc
+++ b/gcc/tree-vect-loop-manip.cc
@@ -1792,6 +1792,10 @@ find_loop_location (class loop *loop)
if (!loop)
return dump_user_location_t ();
+ /* For the root of the loop tree return the function location. */
+ if (!loop_outer (loop))
+ return dump_user_location_t::from_function_decl (cfun->decl);
+
if (loops_state_satisfies_p (LOOPS_HAVE_RECORDED_EXITS))
{
/* We only care about the loop location, so use any exit with location