[gcc(refs/vendors/redhat/heads/gcc-10-branch)] tree-optimization/94352 - fix uninitialized use of curr_order

Jakub Jelinek jakub@gcc.gnu.org
Sat Mar 28 09:42:49 GMT 2020


https://gcc.gnu.org/g:917e21e8bcddf5047ee0ced063fca412ad81ce7f

commit 917e21e8bcddf5047ee0ced063fca412ad81ce7f
Author: Richard Biener <rguenther@suse.de>
Date:   Fri Mar 27 13:52:31 2020 +0100

    tree-optimization/94352 - fix uninitialized use of curr_order
    
    This fixes a (harmless) use of a not re-initialized curr_order.
    
    2020-03-27  Richard Biener  <rguenther@suse.de>
    
            PR tree-optimization/94352
            * tree-ssa-propagate.c (ssa_prop_init): Move seeding of the
            worklist ...
            (ssa_propagation_engine::ssa_propagate): ... here after
            initializing curr_order.

Diff:
---
 gcc/ChangeLog            |  8 ++++++++
 gcc/tree-ssa-propagate.c | 19 ++++++++++---------
 2 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index bf7204f82df..97cad024271 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2020-03-27  Richard Biener  <rguenther@suse.de>
+
+	PR tree-optimization/94352
+	* tree-ssa-propagate.c (ssa_prop_init): Move seeding of the
+	worklist ...
+	(ssa_propagation_engine::ssa_propagate): ... here after
+	initializing curr_order.
+
 2020-03-27  Kewen Lin  <linkw@gcc.gnu.org>
 
 	PR tree-optimization/90332
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c
index 06d4b2a74c7..2fad2472775 100644
--- a/gcc/tree-ssa-propagate.c
+++ b/gcc/tree-ssa-propagate.c
@@ -421,14 +421,6 @@ ssa_prop_init (void)
 	e->flags &= ~EDGE_EXECUTABLE;
     }
   uid_to_stmt.safe_grow (gimple_stmt_max_uid (cfun));
-
-  /* Seed the algorithm by adding the successors of the entry block to the
-     edge worklist.  */
-  FOR_EACH_EDGE (e, ei, ENTRY_BLOCK_PTR_FOR_FN (cfun)->succs)
-    {
-      e->flags &= ~EDGE_EXECUTABLE;
-      add_control_edge (e);
-    }
 }
 
 
@@ -758,7 +750,16 @@ ssa_propagation_engine::ssa_propagate (void)
 
   /* Iterate until the worklists are empty.  We iterate both blocks
      and stmts in RPO order, using sets of two worklists to first
-     complete the current iteration before iterating over backedges.  */
+     complete the current iteration before iterating over backedges.
+     Seed the algorithm by adding the successors of the entry block to the
+     edge worklist.  */
+  edge e;
+  edge_iterator ei;
+  FOR_EACH_EDGE (e, ei, ENTRY_BLOCK_PTR_FOR_FN (cfun)->succs)
+    {
+      e->flags &= ~EDGE_EXECUTABLE;
+      add_control_edge (e);
+    }
   while (1)
     {
       int next_block_order = (bitmap_empty_p (cfg_blocks)


More information about the Gcc-cvs mailing list