[gcc r16-5335] Avoid scanning all stmts outside of loops in LIM

Richard Biener rguenth@gcc.gnu.org
Mon Nov 17 12:09:59 GMT 2025


https://gcc.gnu.org/g:cc36c54845c23b64899de754e70f862cab2478ad

commit r16-5335-gcc36c54845c23b64899de754e70f862cab2478ad
Author: Richard Biener <rguenther@suse.de>
Date:   Mon Nov 17 09:56:13 2025 +0100

    Avoid scanning all stmts outside of loops in LIM
    
    The following avoids scanning stmts outside of loops for possibly
    not returning calls.
    
            * tree-ssa-loop-im.cc (fill_always_executed_in): Skip
            blocks not in loops when looking for possibly not returning
            calls.

Diff:
---
 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 0340857058bb..4c0a46f93e63 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))
 	{


More information about the Gcc-cvs mailing list