summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2022-05-18 15:07:53 +0200
committerMartin Liska <mliska@suse.cz>2022-06-23 12:10:09 +0200
commitc600ff8dc5a870d952c9c63fe4fa4535b9f0a488 (patch)
tree98b10d08a9d2ef58e70a7dc74e00ac53274d00ab
parenttree-object-size: Don't let error_mark_node escape for ADDR_EXPR [PR105736] (diff)
downloadgcc-c600ff8dc5a870d952c9c63fe4fa4535b9f0a488.tar.gz
gcc-c600ff8dc5a870d952c9c63fe4fa4535b9f0a488.tar.bz2
gcc-c600ff8dc5a870d952c9c63fe4fa4535b9f0a488.tar.xz
ipa-icf: skip variables with body_removed
Similarly to cgraph_nodes, it may happen that body_removed is set during merging of symbols. PR ipa/105600 gcc/ChangeLog: * ipa-icf.cc (sem_item_optimizer::filter_removed_items): Skip variables with body_removed. (cherry picked from commit 31ce821a790caec8a2849dd67a9847e78a33d14c)
-rw-r--r--gcc/ipa-icf.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/ipa-icf.cc b/gcc/ipa-icf.cc
index 765ae746745..6528a7a10b2 100644
--- a/gcc/ipa-icf.cc
+++ b/gcc/ipa-icf.cc
@@ -2411,10 +2411,11 @@ sem_item_optimizer::filter_removed_items (void)
2411 { 2411 {
2412 /* Filter out non-readonly variables. */ 2412 /* Filter out non-readonly variables. */
2413 tree decl = item->decl; 2413 tree decl = item->decl;
2414 if (TREE_READONLY (decl)) 2414 varpool_node *vnode = static_cast <sem_variable *>(item)->get_node ();
2415 filtered.safe_push (item); 2415 if (!TREE_READONLY (decl) || vnode->body_removed)
2416 else
2417 remove_item (item); 2416 remove_item (item);
2417 else
2418 filtered.safe_push (item);
2418 } 2419 }
2419 } 2420 }
2420 } 2421 }