tree-optimization/94352 - fix uninitialized use of curr_order
authorRichard Biener <rguenther@suse.de>
Fri, 27 Mar 2020 12:52:31 +0000 (13:52 +0100)
committerRichard Biener <rguenther@suse.de>
Fri, 27 Mar 2020 12:55:22 +0000 (13:55 +0100)
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.

gcc/ChangeLog
gcc/tree-ssa-propagate.c

index bf7204f82dfc7ad278855a205a0c213116253510..97cad024271f7731795a5d879f4c712891d139ae 100644 (file)
@@ -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
index 06d4b2a74c77ae3a19ad2dea95bf962dcc7e50cb..2fad247277556a5be6be2de50a03166cb5ad87b1 100644 (file)
@@ -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)