Save ref->speculative_id before clone_reference.
authorMartin Liska <mliska@suse.cz>
Mon, 23 Mar 2020 07:57:06 +0000 (08:57 +0100)
committerMartin Liska <mliska@suse.cz>
Mon, 23 Mar 2020 07:57:06 +0000 (08:57 +0100)
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
gcc/symtab.c

index 96883830929e5e545f9e5a218b81859319c70ed3..6ba82946a50a032faf924c9bf21bfeff621380a6 100644 (file)
@@ -1,3 +1,11 @@
+2020-03-23  Martin Liska  <mliska@suse.cz>
+
+       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  <iain@sandoe.co.uk>
 
        * config/i386/darwin.h (JUMP_TABLES_IN_TEXT_SECTION): Remove
index 3022acfc1ea09369a8e1e91c8f9ae62fe94c48b6..a36cdccf9c1652d69e7812857cd5cec5f1da5f2f 100644 (file)
@@ -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;
 }