Inline all range info instead of just integers.
Checks
Commit Message
This does a similar thing for inlining. Currently, inlining bails if the type is POINTER. This treats pointers just like normal ranges, except any local points to information is removed. Rather than going through a prange, it efficiently goes through the prange storage that is in the global table.
Bootstraps on x86_64-pc-linux-gnu with no regressions. OK?
Andrew
Now that prange is supported at the global level, we can inline it
as well, as long as we remove any local points to info.
* tree-inline.cc (remap_ssa_name): Inline pointers after
removing local points-to info.
* tree-ssanames.cc (clear_function_local_points_to): New for
global name.
* tree-ssanames.h (clear_function_local_points_to): New prototype.
* value-range-storage.cc (prange_storage::clear_local_points_to): New.
* value-range-storage.h (prange_storage::clear_local_points_to): New
prototype.
---
gcc/tree-inline.cc | 26 ++++++++++++++++----------
gcc/tree-ssanames.cc | 14 ++++++++++++++
gcc/tree-ssanames.h | 1 +
gcc/value-range-storage.cc | 24 ++++++++++++++++++++++++
gcc/value-range-storage.h | 1 +
5 files changed, 56 insertions(+), 10 deletions(-)
Comments
On Tue, Nov 3, 2026 at 7:44 PM Andrew MacLeod <amacleod@redhat.com> wrote:
>
> This does a similar thing for inlining. Currently, inlining bails if the type is POINTER. This treats pointers just like normal ranges, except any local points to information is removed. Rather than going through a prange, it efficiently goes through the prange storage that is in the global table.
>
> Bootstraps on x86_64-pc-linux-gnu with no regressions. OK?
>
> Andrew
>
>
>
>
> Now that prange is supported at the global level, we can inline it
> as well, as long as we remove any local points to info.
>
> * tree-inline.cc (remap_ssa_name): Inline pointers after
> removing local points-to info.
> * tree-ssanames.cc (clear_function_local_points_to): New for
> global name.
> * tree-ssanames.h (clear_function_local_points_to): New prototype.
> * value-range-storage.cc (prange_storage::clear_local_points_to): New.
> * value-range-storage.h (prange_storage::clear_local_points_to): New
> prototype.
> ---
> gcc/tree-inline.cc | 26 ++++++++++++++++----------
> gcc/tree-ssanames.cc | 14 ++++++++++++++
> gcc/tree-ssanames.h | 1 +
> gcc/value-range-storage.cc | 24 ++++++++++++++++++++++++
> gcc/value-range-storage.h | 1 +
> 5 files changed, 56 insertions(+), 10 deletions(-)
>
> diff --git a/gcc/tree-inline.cc b/gcc/tree-inline.cc
> index 7d73d595907..0f899430008 100644
> --- a/gcc/tree-inline.cc
> +++ b/gcc/tree-inline.cc
> @@ -241,17 +241,20 @@ remap_ssa_name (tree name, copy_body_data *id)
> insert_decl_map (id, name, new_tree);
> SSA_NAME_OCCURS_IN_ABNORMAL_PHI (new_tree)
> = SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name);
> - /* At least IPA points-to info can be directly transferred. */
> + /* Range-info can be transferred. */
> + if (SSA_NAME_RANGE_INFO (name))
> + {
> + duplicate_ssa_name_range_info (new_tree, name);
> + /* If there is any local points to, clear it. */
> + clear_function_local_points_to (new_tree);
> + }
> + /* IPA points-to info can be directly transferred. */
> if (id->src_cfun->gimple_df
> && id->src_cfun->gimple_df->ipa_pta
> && POINTER_TYPE_P (TREE_TYPE (name))
> && (pt = ssa_name_pt_solution (name))
> && !pt->anything)
> set_ssa_name_pt_solution (new_tree, *pt);
> - /* So can range-info. */
> - if (!POINTER_TYPE_P (TREE_TYPE (name))
> - && SSA_NAME_RANGE_INFO (name))
> - duplicate_ssa_name_range_info (new_tree, name);
> return new_tree;
> }
>
> @@ -275,17 +278,20 @@ remap_ssa_name (tree name, copy_body_data *id)
> insert_decl_map (id, name, new_tree);
> SSA_NAME_OCCURS_IN_ABNORMAL_PHI (new_tree)
> = SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name);
> - /* At least IPA points-to info can be directly transferred. */
> + /* Range-info can be transferred. */
> + if (SSA_NAME_RANGE_INFO (name))
> + {
> + duplicate_ssa_name_range_info (new_tree, name);
This now also duplicates the pt-solution (IIRC from an earlier patch?)
> + // If there is any local points to, clear it.
> + clear_function_local_points_to (new_tree);
But you need to clear the pt-solution?
IMO the (not so) "shared" APIs are now very confusing - having
a separate m_pt and API to access/reset that.
> + }
> + /* IPA points-to info can be directly transferred. */
> if (id->src_cfun->gimple_df
> && id->src_cfun->gimple_df->ipa_pta
> && POINTER_TYPE_P (TREE_TYPE (name))
> && (pt = ssa_name_pt_solution (name))
> && !pt->anything)
> set_ssa_name_pt_solution (new_tree, *pt);
> - /* So can range-info. */
> - if (!POINTER_TYPE_P (TREE_TYPE (name))
> - && SSA_NAME_RANGE_INFO (name))
> - duplicate_ssa_name_range_info (new_tree, name);
> if (SSA_NAME_IS_DEFAULT_DEF (name))
> {
> /* By inlining function having uninitialized variable, we might
> diff --git a/gcc/tree-ssanames.cc b/gcc/tree-ssanames.cc
> index b24cdc878ca..46ae07a49a9 100644
> --- a/gcc/tree-ssanames.cc
> +++ b/gcc/tree-ssanames.cc
> @@ -978,6 +978,20 @@ clear_function_local_points_to (vrange &r)
> return false;
> }
>
> +
> +// If NAME is a pointer with local points_to information, clear it.
> +// Return TRUE if it was changed.
> +
> +bool
> +clear_function_local_points_to (tree name)
This uses the same odd naming as the previous patch. What is
"function local points to"?
> +{
> + prange_storage *s = ssa_name_prange_storage (name);
> + if (!s)
> + return false;
> + return s->clear_local_points_to ();
or "local" points-to? I'd prefer "reset" over "clear".
> +}
> +
> +
> /* Copy any global range information from SRC to NAME. */
>
> void
> diff --git a/gcc/tree-ssanames.h b/gcc/tree-ssanames.h
> index 219e11428a5..971fdce99c4 100644
> --- a/gcc/tree-ssanames.h
> +++ b/gcc/tree-ssanames.h
> @@ -72,6 +72,7 @@ extern void duplicate_ssa_name_ptr_info (tree dest, const pt_solution *);
> extern void duplicate_ssa_name_ptr_info (tree dest, tree src);
> extern void duplicate_ssa_name_range_info (tree dest, tree src);
> extern bool clear_function_local_points_to (vrange &);
> +extern bool clear_function_local_points_to (tree);
> extern void maybe_duplicate_ssa_info_at_copy (tree dest, tree src);
> extern void reset_flow_sensitive_info (tree);
> extern void reset_flow_sensitive_info_in_bb (basic_block);
> diff --git a/gcc/value-range-storage.cc b/gcc/value-range-storage.cc
> index b7b23e380e4..3f25c4c26dd 100644
> --- a/gcc/value-range-storage.cc
> +++ b/gcc/value-range-storage.cc
> @@ -811,6 +811,30 @@ prange_storage::get_prange (prange &r, tree type) const
> r.verify_range ();
> }
>
> +// If this prange contains any local points to infomration which
> +// is not valid, clear it.
> +
> +bool
> +prange_storage::clear_local_points_to ()
> +{
> + switch (m_kind)
> + {
> + case PR_UNDEFINED:
> + case PR_VARYING:
> + case PR_ZERO:
> + return false;
> + default:
> + break;
> + }
> + if (m_pt && !is_gimple_ip_invariant (m_pt))
> + {
> + m_points_to_p = false;
> + m_pt = NULL;
> + return true;
> + }
> + return false;
So this doesn't do anything to pt_solution, so IMO the name is
misleading.
> +}
> +
> bool
> prange_storage::equal_p (const prange &r) const
> {
> diff --git a/gcc/value-range-storage.h b/gcc/value-range-storage.h
> index d721961c6c2..b797cb83ce2 100644
> --- a/gcc/value-range-storage.h
> +++ b/gcc/value-range-storage.h
> @@ -134,6 +134,7 @@ public:
> irange_bitmask get_bitmask (tree type) const;
> bool nonnull_p (tree type) const;
> void set_nonnull (tree type);
> + bool clear_local_points_to ();
> void dump () const;
>
> // The points-to solution for the SSA name is flow insensitive and is
> --
> 2.56.0
>
On 11/4/26 3:19 AM, Richard Biener wrote:
> On Tue, Nov 3, 2026 at 7:44 PM Andrew MacLeod <amacleod@redhat.com> wrote:
>>
>> This does a similar thing for inlining. Currently, inlining bails if the type is POINTER. This treats pointers just like normal ranges, except any local points to information is removed. Rather than going through a prange, it efficiently goes through the prange storage that is in the global table.
>>
>> Bootstraps on x86_64-pc-linux-gnu with no regressions. OK?
>>
>> Andrew
>>
>>
>>
>>
>> Now that prange is supported at the global level, we can inline it
>> as well, as long as we remove any local points to info.
>>
>> * tree-inline.cc (remap_ssa_name): Inline pointers after
>> removing local points-to info.
>> * tree-ssanames.cc (clear_function_local_points_to): New for
>> global name.
>> * tree-ssanames.h (clear_function_local_points_to): New prototype.
>> * value-range-storage.cc (prange_storage::clear_local_points_to): New.
>> * value-range-storage.h (prange_storage::clear_local_points_to): New
>> prototype.
>> ---
>> gcc/tree-inline.cc | 26 ++++++++++++++++----------
>> gcc/tree-ssanames.cc | 14 ++++++++++++++
>> gcc/tree-ssanames.h | 1 +
>> gcc/value-range-storage.cc | 24 ++++++++++++++++++++++++
>> gcc/value-range-storage.h | 1 +
>> 5 files changed, 56 insertions(+), 10 deletions(-)
>>
>> diff --git a/gcc/tree-inline.cc b/gcc/tree-inline.cc
>> index 7d73d595907..0f899430008 100644
>> --- a/gcc/tree-inline.cc
>> +++ b/gcc/tree-inline.cc
>> @@ -241,17 +241,20 @@ remap_ssa_name (tree name, copy_body_data *id)
>> insert_decl_map (id, name, new_tree);
>> SSA_NAME_OCCURS_IN_ABNORMAL_PHI (new_tree)
>> = SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name);
>> - /* At least IPA points-to info can be directly transferred. */
>> + /* Range-info can be transferred. */
>> + if (SSA_NAME_RANGE_INFO (name))
>> + {
>> + duplicate_ssa_name_range_info (new_tree, name);
>> + /* If there is any local points to, clear it. */
>> + clear_function_local_points_to (new_tree);
>> + }
>> + /* IPA points-to info can be directly transferred. */
>> if (id->src_cfun->gimple_df
>> && id->src_cfun->gimple_df->ipa_pta
>> && POINTER_TYPE_P (TREE_TYPE (name))
>> && (pt = ssa_name_pt_solution (name))
>> && !pt->anything)
>> set_ssa_name_pt_solution (new_tree, *pt);
>> - /* So can range-info. */
>> - if (!POINTER_TYPE_P (TREE_TYPE (name))
>> - && SSA_NAME_RANGE_INFO (name))
>> - duplicate_ssa_name_range_info (new_tree, name);
>> return new_tree;
>> }
>>
>> @@ -275,17 +278,20 @@ remap_ssa_name (tree name, copy_body_data *id)
>> insert_decl_map (id, name, new_tree);
>> SSA_NAME_OCCURS_IN_ABNORMAL_PHI (new_tree)
>> = SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name);
>> - /* At least IPA points-to info can be directly transferred. */
>> + /* Range-info can be transferred. */
>> + if (SSA_NAME_RANGE_INFO (name))
>> + {
>> + duplicate_ssa_name_range_info (new_tree, name);
>
> This now also duplicates the pt-solution (IIRC from an earlier patch?)
The opposite. The earlier patch splits pt_solution from range info completely.. ie if you want to duplicate pt_solution infomration, you have to explicitly call
duplicate_ssa_name_ptr_info () duplicate_ssa-name_range_info no longer calls it. Almost every caller of duplicate_ssa_name_range info was then clearing the pt_solution infomration that was duplicated... so the split made sense and here its just duplicating the range info now.
>
>> + // If there is any local points to, clear it.
>> + clear_function_local_points_to (new_tree);
>
> But you need to clear the pt-solution?
>
> IMO the (not so) "shared" APIs are now very confusing - having
> a separate m_pt and API to access/reset that.
It certainly is confusing, this is the prange local m_pt points to that has to be cleared.. you cant point-to &var from one function in another .
Im open to suggestions. within a prange we have points-to and points-away vs the pt_solution set of pt_ prefixes. THey clash harder at this particular place because we are dealing with a prange_storage object and so are referring to it by name in the global tables.
hmm. It was mostly a shortcut to avoid
if (SSA_NAME_RANGE_INFO (name) && is_a<prange_storage *> (SSA_NAME_RANGE_INFO (name))
as_a<prange_storage *> (SSA_NAME_RANGE_INFO (name)->set_pt_unknown ();
That would probably be less confusing... let me rework these two to look like that, and maybe the confusion willbe resolve itself.
Andrew
PS Im also open to suggestions on renaming the points_to and points_away interface within prange... but maybe that wont be neccessary with these changes.
>> + }
>> + /* IPA points-to info can be directly transferred. */
>> if (id->src_cfun->gimple_df
>> && id->src_cfun->gimple_df->ipa_pta
>> && POINTER_TYPE_P (TREE_TYPE (name))
>> && (pt = ssa_name_pt_solution (name))
>> && !pt->anything)
>> set_ssa_name_pt_solution (new_tree, *pt);
>> - /* So can range-info. */
>> - if (!POINTER_TYPE_P (TREE_TYPE (name))
>> - && SSA_NAME_RANGE_INFO (name))
>> - duplicate_ssa_name_range_info (new_tree, name);
>> if (SSA_NAME_IS_DEFAULT_DEF (name))
>> {
>> /* By inlining function having uninitialized variable, we might
>> diff --git a/gcc/tree-ssanames.cc b/gcc/tree-ssanames.cc
>> index b24cdc878ca..46ae07a49a9 100644
>> --- a/gcc/tree-ssanames.cc
>> +++ b/gcc/tree-ssanames.cc
>> @@ -978,6 +978,20 @@ clear_function_local_points_to (vrange &r)
>> return false;
>> }
>>
>> +
>> +// If NAME is a pointer with local points_to information, clear it.
>> +// Return TRUE if it was changed.
>> +
>> +bool
>> +clear_function_local_points_to (tree name)
>
> This uses the same odd naming as the previous patch. What is
> "function local points to"?
>
>> +{
>> + prange_storage *s = ssa_name_prange_storage (name);
>> + if (!s)
>> + return false;
>> + return s->clear_local_points_to ();
>
> or "local" points-to? I'd prefer "reset" over "clear".
>
>> +}
>> +
>> +
>> /* Copy any global range information from SRC to NAME. */
>>
>> void
>> diff --git a/gcc/tree-ssanames.h b/gcc/tree-ssanames.h
>> index 219e11428a5..971fdce99c4 100644
>> --- a/gcc/tree-ssanames.h
>> +++ b/gcc/tree-ssanames.h
>> @@ -72,6 +72,7 @@ extern void duplicate_ssa_name_ptr_info (tree dest, const pt_solution *);
>> extern void duplicate_ssa_name_ptr_info (tree dest, tree src);
>> extern void duplicate_ssa_name_range_info (tree dest, tree src);
>> extern bool clear_function_local_points_to (vrange &);
>> +extern bool clear_function_local_points_to (tree);
>> extern void maybe_duplicate_ssa_info_at_copy (tree dest, tree src);
>> extern void reset_flow_sensitive_info (tree);
>> extern void reset_flow_sensitive_info_in_bb (basic_block);
>> diff --git a/gcc/value-range-storage.cc b/gcc/value-range-storage.cc
>> index b7b23e380e4..3f25c4c26dd 100644
>> --- a/gcc/value-range-storage.cc
>> +++ b/gcc/value-range-storage.cc
>> @@ -811,6 +811,30 @@ prange_storage::get_prange (prange &r, tree type) const
>> r.verify_range ();
>> }
>>
>> +// If this prange contains any local points to infomration which
>> +// is not valid, clear it.
>> +
>> +bool
>> +prange_storage::clear_local_points_to ()
>> +{
>> + switch (m_kind)
>> + {
>> + case PR_UNDEFINED:
>> + case PR_VARYING:
>> + case PR_ZERO:
>> + return false;
>> + default:
>> + break;
>> + }
>> + if (m_pt && !is_gimple_ip_invariant (m_pt))
>> + {
>> + m_points_to_p = false;
>> + m_pt = NULL;
>> + return true;
>> + }
>> + return false;
>
> So this doesn't do anything to pt_solution, so IMO the name is
> misleading.
>
>> +}
>> +
>> bool
>> prange_storage::equal_p (const prange &r) const
>> {
>> diff --git a/gcc/value-range-storage.h b/gcc/value-range-storage.h
>> index d721961c6c2..b797cb83ce2 100644
>> --- a/gcc/value-range-storage.h
>> +++ b/gcc/value-range-storage.h
>> @@ -134,6 +134,7 @@ public:
>> irange_bitmask get_bitmask (tree type) const;
>> bool nonnull_p (tree type) const;
>> void set_nonnull (tree type);
>> + bool clear_local_points_to ();
>> void dump () const;
>>
>> // The points-to solution for the SSA name is flow insensitive and is
>> --
>> 2.56.0
>>
>
On 11/4/26 3:19 AM, Richard Biener wrote:
> On Tue, Nov 3, 2026 at 7:44 PM Andrew MacLeod <amacleod@redhat.com> wrote:
>
> IMO the (not so) "shared" APIs are now very confusing - having
> a separate m_pt and API to access/reset that.
>OK, lets clear up the API confusion. The original prange "points-to" work didnt take into account the pt_solution "conflict" very well.
So, to address that, lets rename the prange API. the existing implementation is a must-point to and is really address centric, so I have changed the API to be "addr" based rather than "pt" point-to, and change the terminology to "known" and "excluded" instead of "points_to" and "points_away". this should eliminate any confusion. The follow on work that deals with regions like pointer_query seems to fit into this address concept quite cleanly.
This feels better to me anyway and I think it seems more concise than before.
These are all methods in either prange or prange_storage, and the old to new API mapping looks like this:
set_pt (const prange &) -> set_addr (const prange &)
set_pt (tree, bool points_to_p)-> set_addr (tree, bool known_p)
set_pt_unknown () -> set_addr_unknown ()
pt_unknown_p () -> addr_unknown_p ()
pt_invariant () -> addr_known ()
pt_invariant_away () -> addr_excluded ()
pt_invariant_p (r) -> addr_same_known_p (r)
pt_invariant_away_p (r) -> addr_same_excluded_p (r)
pt_inverted_p (r) -> addr_inverted_p (r)
pt_invert () -> addr_invert ()
pt_equal_p (p) -> addr_equal_p (p) [private]
pt_base () -> addr_base ()
pt_offset (irange &) -> addr_offset (irange &)
pt_size (irange &) -> addr_size (irange &)
prange::m_pt -> prange::m_addr
prange::m_points_to_p -> prange::m_known_p
prange_storage::m_pt -> prange_storage::m_addr
prange_storage::m_points_to_p -> prange_storage::m_known_p
vrange_printer::print_pt () -> print_addr ()
Ive got a patch in progress and testing, I just want to know if this seems reasonable before committing it and creating unnecessary churn.
Is this terminology good enough, or do you have alternative suggestions? Otherwise I'll be committing this API change tomorrow sometime.
Then I'll provide a new clearer patch for the IPA and inlining cleanups.
Andrew
On Wed, Nov 4, 2026 at 11:18 PM Andrew MacLeod <amacleod@redhat.com> wrote:
>
> On 11/4/26 3:19 AM, Richard Biener wrote:
> > On Tue, Nov 3, 2026 at 7:44 PM Andrew MacLeod <amacleod@redhat.com> wrote:
>
> >
> > IMO the (not so) "shared" APIs are now very confusing - having
> > a separate m_pt and API to access/reset that.
> >OK, lets clear up the API confusion. The original prange "points-to" work didnt take into account the pt_solution "conflict" very well.
>
> So, to address that, lets rename the prange API. the existing implementation is a must-point to and is really address centric, so I have changed the API to be "addr" based rather than "pt" point-to, and change the terminology to "known" and "excluded" instead of "points_to" and "points_away". this should eliminate any confusion. The follow on work that deals with regions like pointer_query seems to fit into this address concept quite cleanly.
>
> This feels better to me anyway and I think it seems more concise than before.
>
> These are all methods in either prange or prange_storage, and the old to new API mapping looks like this:
>
> set_pt (const prange &) -> set_addr (const prange &)
> set_pt (tree, bool points_to_p)-> set_addr (tree, bool known_p)
> set_pt_unknown () -> set_addr_unknown ()
> pt_unknown_p () -> addr_unknown_p ()
>
> pt_invariant () -> addr_known ()
> pt_invariant_away () -> addr_excluded ()
> pt_invariant_p (r) -> addr_same_known_p (r)
> pt_invariant_away_p (r) -> addr_same_excluded_p (r)
> pt_inverted_p (r) -> addr_inverted_p (r)
> pt_invert () -> addr_invert ()
> pt_equal_p (p) -> addr_equal_p (p) [private]
>
> pt_base () -> addr_base ()
> pt_offset (irange &) -> addr_offset (irange &)
> pt_size (irange &) -> addr_size (irange &)
>
> prange::m_pt -> prange::m_addr
> prange::m_points_to_p -> prange::m_known_p
> prange_storage::m_pt -> prange_storage::m_addr
> prange_storage::m_points_to_p -> prange_storage::m_known_p
>
> vrange_printer::print_pt () -> print_addr ()
That looks nice. I was about to suggest to do s/pt/prange/ but 'addr'
is better. Given we have
pt_* APIs to inspect points-to solutions then using pt_ for points-to
related APIs would restore
some consistency here. There's then still things like
duplicate_ssa_name_ptr_info which
is tied to the former ptr_info_def structure name, and
set_ptr_info_alignment. Making it
more clear that the former affects pt_solution
(duplicate_ssa_name_pt_solution) and the
latter now affects range info (set_known_alignment?) might be an
improvement, but I
think we can defer this to a 2nd stage.
> Ive got a patch in progress and testing, I just want to know if this seems reasonable before committing it and creating unnecessary churn.
>
> Is this terminology good enough, or do you have alternative suggestions? Otherwise I'll be committing this API change tomorrow sometime.
>
> Then I'll provide a new clearer patch for the IPA and inlining cleanups.
>
> Andrew
>
>
>
@@ -241,17 +241,20 @@ remap_ssa_name (tree name, copy_body_data *id)
insert_decl_map (id, name, new_tree);
SSA_NAME_OCCURS_IN_ABNORMAL_PHI (new_tree)
= SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name);
- /* At least IPA points-to info can be directly transferred. */
+ /* Range-info can be transferred. */
+ if (SSA_NAME_RANGE_INFO (name))
+ {
+ duplicate_ssa_name_range_info (new_tree, name);
+ /* If there is any local points to, clear it. */
+ clear_function_local_points_to (new_tree);
+ }
+ /* IPA points-to info can be directly transferred. */
if (id->src_cfun->gimple_df
&& id->src_cfun->gimple_df->ipa_pta
&& POINTER_TYPE_P (TREE_TYPE (name))
&& (pt = ssa_name_pt_solution (name))
&& !pt->anything)
set_ssa_name_pt_solution (new_tree, *pt);
- /* So can range-info. */
- if (!POINTER_TYPE_P (TREE_TYPE (name))
- && SSA_NAME_RANGE_INFO (name))
- duplicate_ssa_name_range_info (new_tree, name);
return new_tree;
}
@@ -275,17 +278,20 @@ remap_ssa_name (tree name, copy_body_data *id)
insert_decl_map (id, name, new_tree);
SSA_NAME_OCCURS_IN_ABNORMAL_PHI (new_tree)
= SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name);
- /* At least IPA points-to info can be directly transferred. */
+ /* Range-info can be transferred. */
+ if (SSA_NAME_RANGE_INFO (name))
+ {
+ duplicate_ssa_name_range_info (new_tree, name);
+ // If there is any local points to, clear it.
+ clear_function_local_points_to (new_tree);
+ }
+ /* IPA points-to info can be directly transferred. */
if (id->src_cfun->gimple_df
&& id->src_cfun->gimple_df->ipa_pta
&& POINTER_TYPE_P (TREE_TYPE (name))
&& (pt = ssa_name_pt_solution (name))
&& !pt->anything)
set_ssa_name_pt_solution (new_tree, *pt);
- /* So can range-info. */
- if (!POINTER_TYPE_P (TREE_TYPE (name))
- && SSA_NAME_RANGE_INFO (name))
- duplicate_ssa_name_range_info (new_tree, name);
if (SSA_NAME_IS_DEFAULT_DEF (name))
{
/* By inlining function having uninitialized variable, we might
@@ -978,6 +978,20 @@ clear_function_local_points_to (vrange &r)
return false;
}
+
+// If NAME is a pointer with local points_to information, clear it.
+// Return TRUE if it was changed.
+
+bool
+clear_function_local_points_to (tree name)
+{
+ prange_storage *s = ssa_name_prange_storage (name);
+ if (!s)
+ return false;
+ return s->clear_local_points_to ();
+}
+
+
/* Copy any global range information from SRC to NAME. */
void
@@ -72,6 +72,7 @@ extern void duplicate_ssa_name_ptr_info (tree dest, const pt_solution *);
extern void duplicate_ssa_name_ptr_info (tree dest, tree src);
extern void duplicate_ssa_name_range_info (tree dest, tree src);
extern bool clear_function_local_points_to (vrange &);
+extern bool clear_function_local_points_to (tree);
extern void maybe_duplicate_ssa_info_at_copy (tree dest, tree src);
extern void reset_flow_sensitive_info (tree);
extern void reset_flow_sensitive_info_in_bb (basic_block);
@@ -811,6 +811,30 @@ prange_storage::get_prange (prange &r, tree type) const
r.verify_range ();
}
+// If this prange contains any local points to infomration which
+// is not valid, clear it.
+
+bool
+prange_storage::clear_local_points_to ()
+{
+ switch (m_kind)
+ {
+ case PR_UNDEFINED:
+ case PR_VARYING:
+ case PR_ZERO:
+ return false;
+ default:
+ break;
+ }
+ if (m_pt && !is_gimple_ip_invariant (m_pt))
+ {
+ m_points_to_p = false;
+ m_pt = NULL;
+ return true;
+ }
+ return false;
+}
+
bool
prange_storage::equal_p (const prange &r) const
{
@@ -134,6 +134,7 @@ public:
irange_bitmask get_bitmask (tree type) const;
bool nonnull_p (tree type) const;
void set_nonnull (tree type);
+ bool clear_local_points_to ();
void dump () const;
// The points-to solution for the SSA name is flow insensitive and is