aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfganal.c
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2021-09-13 10:37:49 -0700
committerIan Lance Taylor <iant@golang.org>2021-09-13 10:37:49 -0700
commite252b51ccde010cbd2a146485d8045103cd99533 (patch)
treee060f101cdc32bf5e520de8e5275db9d4236b74c /gcc/cfganal.c
parentf10c7c4596dda99d2ee872c995ae4aeda65adbdf (diff)
parent104c05c5284b7822d770ee51a7d91946c7e56d50 (diff)
downloadgcc-e252b51ccde010cbd2a146485d8045103cd99533.zip
gcc-e252b51ccde010cbd2a146485d8045103cd99533.tar.gz
gcc-e252b51ccde010cbd2a146485d8045103cd99533.tar.bz2
Merge from trunk revision 104c05c5284b7822d770ee51a7d91946c7e56d50.
Diffstat (limited to 'gcc/cfganal.c')
-rw-r--r--gcc/cfganal.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/cfganal.c b/gcc/cfganal.c
index 2627c2f..cec5abe 100644
--- a/gcc/cfganal.c
+++ b/gcc/cfganal.c
@@ -582,9 +582,9 @@ add_noreturn_fake_exit_edges (void)
make_single_succ_edge (bb, EXIT_BLOCK_PTR_FOR_FN (cfun), EDGE_FAKE);
}
-/* This function adds a fake edge between any infinite loops to the
- exit block. Some optimizations require a path from each node to
- the exit node.
+/* This function adds a fake edge between any noreturn block and
+ infinite loops to the exit block. Some optimizations require a path
+ from each node to the exit node.
See also Morgan, Figure 3.10, pp. 82-83.
@@ -596,6 +596,10 @@ add_noreturn_fake_exit_edges (void)
void
connect_infinite_loops_to_exit (void)
{
+ /* First add fake exits to noreturn blocks, this is required to
+ discover only truly infinite loops below. */
+ add_noreturn_fake_exit_edges ();
+
/* Perform depth-first search in the reverse graph to find nodes
reachable from the exit block. */
depth_first_search dfs;