This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, PR55315] Don't assume a nonzero address plus a const is a nonzero address


On 19/11/12 14:00, Jakub Jelinek wrote:
> On Sun, Nov 18, 2012 at 10:50:53AM +0000, Richard Sandiford wrote:
>> Tom de Vries <Tom_deVries@mentor.com> writes:
>>> 2012-11-17  Tom de Vries  <tom@codesourcery.com>
>>>
>>> 	PR rtl-optimization/55315
>>>
>>> 	* rtlanal.c (nonzero_address_p): Don't assume a nonzero address plus a
>>> 	const is a nonzero address.
>>>
>>> 	* gcc.target/mips/pr55315.c: New test.
>>
>> OK, thanks.
> 

Jakub,

> I think this is just papering over the problem that we don't distinguish
> between pointer and integer arithmetics at RTL level

I'm not sure this is a proper description, since the patch fixes a problem in
the compiler where it generates incorrect code while the test-case is valid.
I agree we can fix this more optimally if we can accurately distinguish between
pointer and integer arithmetics at RTL level.
And as I've just learned from PR 49330, the patch doesn't fix all places where
we incorrectly assume pointer arithmetic, but it does fix one of them.

> (yeah, there is
> REG_POINTER, but can we take it as guaranteed that integer arithmetics
> is performed without REG_POINTER while pointer arithmetics with them?),
> but in many places in RTL we just assume pointer arithmetics rules.
> The above assumption that nonzero_address_p plus constant is nonzero
> should be fine assumption in pointer arithmetics, so are many aliasing
> assumptions, but they aren't valid for integer arithmetics.  We have several
> open PRs for this I believe.

Thanks for making me aware of that. I've found PR 49330 and duplicate PR 52517.
PR 49330 comment 1 lists an example similar to this PR (but AFAIU the
cse/nonzero_address_p scenario is not explicitly discussed there).

Thanks,
- Tom

> 
> 	Jakub
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]