> Hi.
> 
> Similarly to other ipa_ref field, we must preserve the values
> before create_reference is called. It's due to fact that ipa_ref
> is a pointer to a vector that can be relocated to a different location.
> 
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
> 
> Ready to be installed?
OK,
thanks!
Honza
> Thanks,
> Martin
> 
> gcc/ChangeLog:
> 
> 2020-03-21  Martin Liska  <mli...@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.
> ---
>  gcc/symtab.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> 

> 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;
>  }
>  
> 

Reply via email to