re PR tree-optimization/63255 (FAIL: gcc.dg/lto/ipareference2 c_lto_ipareference2_0...
authorJan Hubicka <hubicka@ucw.cz>
Sat, 20 Sep 2014 02:58:42 +0000 (04:58 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Sat, 20 Sep 2014 02:58:42 +0000 (02:58 +0000)
PR tree-optimization/63255
* ipa.c (symbol_table::remove_unreachable_nodes): Fix ordering
issue in setting body_removed flag.

From-SVN: r215415

gcc/ChangeLog
gcc/ipa.c

index c345dc174dd16605997cdc2c7dc2fc943a808ddb..ad435363e08dbc3ac174140cc222aab590ee9e5d 100644 (file)
@@ -1,3 +1,9 @@
+2014-09-19  Jan Hubicka  <hubicka@ucw.cz>
+
+       PR tree-optimization/63255
+       * ipa.c (symbol_table::remove_unreachable_nodes): Fix ordering
+       issue in setting body_removed flag.
+
 2014-09-19  Jan Hubicka  <hubicka@ucw.cz>
 
        PR c++/61825
index 5afacd87b7a548983e02e057c465b5dbae5aaa54..3c35e473e97bbb4744e21f3c6ef48ba6f08a4e35 100644 (file)
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -538,6 +538,11 @@ symbol_table::remove_unreachable_nodes (bool before_inlining_p, FILE *file)
                fprintf (file, " %s", vnode->name ());
              changed = true;
            }
+         /* Keep body if it may be useful for constant folding.  */
+         if ((init = ctor_for_folding (vnode->decl)) == error_mark_node)
+           vnode->remove_initializer ();
+         else
+           DECL_INITIAL (vnode->decl) = init;
          vnode->body_removed = true;
          vnode->definition = false;
          vnode->analyzed = false;
@@ -545,11 +550,6 @@ symbol_table::remove_unreachable_nodes (bool before_inlining_p, FILE *file)
 
          vnode->remove_from_same_comdat_group ();
 
-         /* Keep body if it may be useful for constant folding.  */
-         if ((init = ctor_for_folding (vnode->decl)) == error_mark_node)
-           vnode->remove_initializer ();
-         else
-           DECL_INITIAL (vnode->decl) = init;
          vnode->remove_all_references ();
        }
       else