From 2fa4b1ffd6e4058e53b3a486494b00098ee1bf63 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 23 Mar 2020 08:57:06 +0100 Subject: [PATCH] Save ref->speculative_id before clone_reference. PR ipa/94250 * symtab.c (symtab_node::clone_references): Save speculative_id as ref may be overwritten by create_reference. (symtab_node::clone_referring): Likewise. (symtab_node::clone_reference): Likewise. --- gcc/ChangeLog | 8 ++++++++ gcc/symtab.c | 9 ++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 96883830929..6ba82946a50 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2020-03-23 Martin Liska + + PR ipa/94250 + * symtab.c (symtab_node::clone_references): Save speculative_id + as ref may be overwritten by create_reference. + (symtab_node::clone_referring): Likewise. + (symtab_node::clone_reference): Likewise. + 2020-03-22 Iain Sandoe * config/i386/darwin.h (JUMP_TABLES_IN_TEXT_SECTION): Remove diff --git a/gcc/symtab.c b/gcc/symtab.c index 3022acfc1ea..a36cdccf9c1 100644 --- a/gcc/symtab.c +++ b/gcc/symtab.c @@ -670,11 +670,12 @@ symtab_node::clone_references (symtab_node *node) { bool speculative = ref->speculative; unsigned int stmt_uid = ref->lto_stmt_uid; + unsigned int spec_id = ref->speculative_id; ref2 = create_reference (ref->referred, ref->use, ref->stmt); ref2->speculative = speculative; ref2->lto_stmt_uid = stmt_uid; - ref2->speculative_id = ref->speculative_id; + ref2->speculative_id = spec_id; } } @@ -689,11 +690,12 @@ symtab_node::clone_referring (symtab_node *node) { bool speculative = ref->speculative; unsigned int stmt_uid = ref->lto_stmt_uid; + unsigned int spec_id = ref->speculative_id; ref2 = ref->referring->create_reference (this, ref->use, ref->stmt); ref2->speculative = speculative; ref2->lto_stmt_uid = stmt_uid; - ref2->speculative_id = ref->speculative_id; + ref2->speculative_id = spec_id; } } @@ -704,12 +706,13 @@ symtab_node::clone_reference (ipa_ref *ref, gimple *stmt) { bool speculative = ref->speculative; unsigned int stmt_uid = ref->lto_stmt_uid; + unsigned int spec_id = ref->speculative_id; ipa_ref *ref2; ref2 = create_reference (ref->referred, ref->use, stmt); ref2->speculative = speculative; ref2->lto_stmt_uid = stmt_uid; - ref2->speculative_id = ref->speculative_id; + ref2->speculative_id = spec_id; return ref2; } -- 2.30.2