The following avoids scanning stmts outside of loops for possibly
not returning calls.

Bootstrapped and tested on x86_64-unknow-linux-gnu, pushed.

        * tree-ssa-loop-im.cc (fill_always_executed_in): Skip
        blocks not in loops when looking for possibly not returning
        calls.
---
 gcc/tree-ssa-loop-im.cc | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gcc/tree-ssa-loop-im.cc b/gcc/tree-ssa-loop-im.cc
index 0340857058b..4c0a46f93e6 100644
--- a/gcc/tree-ssa-loop-im.cc
+++ b/gcc/tree-ssa-loop-im.cc
@@ -3534,6 +3534,12 @@ fill_always_executed_in (void)
   bitmap_clear (contains_call);
   FOR_EACH_BB_FN (bb, cfun)
     {
+      if (loop_depth (bb->loop_father) == 0)
+       {
+         /* Outside of loops we can skip scanning all stmts.  */
+         bitmap_set_bit (contains_call, bb->index);
+         continue;
+       }
       gimple_stmt_iterator gsi;
       for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
        {
-- 
2.51.0

Reply via email to