This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/39074] [4.2/4.3/4.4 Regression] PTA constraint processing for *x = y is wrong
- From: "dberlin at dberlin dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Feb 2009 16:37:55 -0000
- Subject: [Bug tree-optimization/39074] [4.2/4.3/4.4 Regression] PTA constraint processing for *x = y is wrong
- References: <bug-39074-10053@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #15 from dberlin at gcc dot gnu dot org 2009-02-04 16:37 -------
Subject: Re: [4.2/4.3/4.4 Regression] PTA
constraint processing for *x = y is wrong
On Wed, Feb 4, 2009 at 11:26 AM, rguenther at suse dot de
<gcc-bugzilla@gcc.gnu.org> wrote:
>
>
> ------- Comment #14 from rguenther at suse dot de 2009-02-04 16:26 -------
> Subject: Re: [4.2/4.3/4.4 Regression] PTA
> constraint processing for *x = y is wrong
>
> On Wed, 4 Feb 2009, dberlin at dberlin dot org wrote:
>
>> ------- Comment #13 from dberlin at gcc dot gnu dot org 2009-02-04 16:09 -------
>> Subject: Re: PTA constraint processing for *x =
>> y is wrong
>>
>> I don't remember offhand. At one point during 4.2 we used to compute
>> the anything set exactly, and it led to massive issues. Of course,
>> most of those were because the anything set had hundreds or thousands
>> of SFT's :).
>>
>> I'm happy to go with your idea for fixing since fixing shortcutting
>> won't fix it, except for two things:
>> 1. ANYTHING is really limited to all addressable variables (IE address
>> taken and escaping), instead of all variables. It was never meant to
>> represent "completely unknown" (IE user has set pointer to (char *)
>> 0xdeadbeef).
>
> Yes, is there a bitmap / array in the PTA graph that I can iterate
> over instead of all vars?
Not right now.
>
>> ISTM the set you union in should be based on CALLUSED and ESCAPED or
>> something thereof, or at least should be computable with constraints
>> during solving, and unioned in when it changes.
>
> Ah, you mean whenever I see *ANYTHING = x union x into a new
> STORE_TO_ANYTHING solution and have an explicit
> *ANYTHING = STORE_TO_ANYTHING constraint (which I of course need
> to handle properly in do_ds_constraint)? That may be indeed faster.
Something like that.
It is going to be faster than doing it one by one all the time.
>> The way off the top of my head to do this is to simply stop using
>> &ANYTHING, and use ANYTHING directly, and then have ANYTHING =
>> CALLUSED and ANYTHING = ESCAPED.
>
> I don't think CALLUSED or ESCAPED are related here. You can store
> non-addressables into *ANYTHING.
How?
If they are non-addressable, that implies they are not pointed to.
I think you are going off the rails here :)
If you really want to union ANYTHING into things, the simplest way is
to change from doing:
ANYTHING = &ANYTHING
a = &y
p_4 = &ANYTHING
p_1 = p_4
p_1 = &a
x_6 = *p_1
derefaddrtmp.11 = &i
*x_6 = derefaddrtmp.11
y.0_7 = y
to
ANYTHING = *ANYTHING
ANYTHING = <all pointers pre-built or whatever we decided on>
a = &y
p_4 = ANYTHING
p_1 = p_4
p_1 = &a
x_6 = *p_1
derefaddrtmp.11 = &i
*x_6 = derefaddrtmp.11
y.0_7 = y
Then p_4 will get the entire anything set, and it will propagate
around just like you wanted.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39074