From 1acc55917e1afae9eed569f45653a122fd99af99 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Sat, 20 Sep 2014 04:58:42 +0200 Subject: [PATCH] re PR tree-optimization/63255 (FAIL: gcc.dg/lto/ipareference2 c_lto_ipareference2_0.o-c_lto_ipareference2_1.o execute -O1 -flto -flto-partition=1to1 -fwhole-program) PR tree-optimization/63255 * ipa.c (symbol_table::remove_unreachable_nodes): Fix ordering issue in setting body_removed flag. From-SVN: r215415 --- gcc/ChangeLog | 6 ++++++ gcc/ipa.c | 10 +++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c345dc174dd..ad435363e08 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-09-19 Jan Hubicka + + PR tree-optimization/63255 + * ipa.c (symbol_table::remove_unreachable_nodes): Fix ordering + issue in setting body_removed flag. + 2014-09-19 Jan Hubicka PR c++/61825 diff --git a/gcc/ipa.c b/gcc/ipa.c index 5afacd87b7a..3c35e473e97 100644 --- 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 -- 2.30.2