* [PR44610] don't delegitimize MEM from base without offset
@ 2010-06-24 9:50 Alexandre Oliva
2010-06-25 9:45 ` Eric Botcazou
2010-10-03 7:41 ` H.J. Lu
0 siblings, 2 replies; 3+ messages in thread
From: Alexandre Oliva @ 2010-06-24 9:50 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 1000 bytes --]
Interesting bug... All words of a multi-word variable ended up mapped
to the same VALUE during cselib in var-tracking, and then their location
was set to the same REG, that held only the first word.
Problem was that we were initializing the variable within a loop, from
an array element that lived in memory and varied per iteration of the
loop. This means the MEM_OFFSETs couldn't be set: they weren't
constant.
Turns out that some recently-added code that attempted to simplify MEMs
to something more palatable than complex expressions involving frame,
stack or GOT pointers, mistook the absence of an offset for a zero
offset. So, because of this delegitimization, each of the words loaded
into part of the variable was regarded by cselib as a MEM referencing
the first word of the array. Oops.
This patch prevents the delegitimization when the offset is unknown, so
that we don't get bogus equivalences.
Regstrapped on x86_64-linux-gnu, i686-linux-gnu and ia64-linux-gnu.
Ok for trunk?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: vta-delegitimize-attrs-memoffset-pr44610.patch --]
[-- Type: text/x-diff, Size: 1062 bytes --]
for gcc/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
PR debug/44610
* simplify-rtx.c (delegitimize_mem_from_attrs): Don't use a base
address if the offset is unknown.
Index: gcc/simplify-rtx.c
===================================================================
--- gcc/simplify-rtx.c.orig 2010-06-23 01:15:14.000000000 -0300
+++ gcc/simplify-rtx.c 2010-06-23 01:20:21.000000000 -0300
@@ -208,10 +208,11 @@ avoid_constant_pool_reference (rtx x)
rtx
delegitimize_mem_from_attrs (rtx x)
{
+ /* MEMs without MEM_OFFSETs may have been offset, so we can't just
+ use their base addresses as equivalent. */
if (MEM_P (x)
&& MEM_EXPR (x)
- && (!MEM_OFFSET (x)
- || GET_CODE (MEM_OFFSET (x)) == CONST_INT))
+ && MEM_OFFSET (x))
{
tree decl = MEM_EXPR (x);
enum machine_mode mode = GET_MODE (x);
@@ -264,8 +265,7 @@ delegitimize_mem_from_attrs (rtx x)
{
rtx newx;
- if (MEM_OFFSET (x))
- offset += INTVAL (MEM_OFFSET (x));
+ offset += INTVAL (MEM_OFFSET (x));
newx = DECL_RTL (decl);
[-- Attachment #3: Type: text/plain, Size: 257 bytes --]
--
Alexandre Oliva, freedom fighter http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/ FSF Latin America board member
Free Software Evangelist Red Hat Brazil Compiler Engineer
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PR44610] don't delegitimize MEM from base without offset
2010-06-24 9:50 [PR44610] don't delegitimize MEM from base without offset Alexandre Oliva
@ 2010-06-25 9:45 ` Eric Botcazou
2010-10-03 7:41 ` H.J. Lu
1 sibling, 0 replies; 3+ messages in thread
From: Eric Botcazou @ 2010-06-25 9:45 UTC (permalink / raw)
To: Alexandre Oliva; +Cc: gcc-patches
> This patch prevents the delegitimization when the offset is unknown, so
> that we don't get bogus equivalences.
>
> Regstrapped on x86_64-linux-gnu, i686-linux-gnu and ia64-linux-gnu.
>
> Ok for trunk?
OK for trunk and 4.5 branch.
--
Eric Botcazou
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PR44610] don't delegitimize MEM from base without offset
2010-06-24 9:50 [PR44610] don't delegitimize MEM from base without offset Alexandre Oliva
2010-06-25 9:45 ` Eric Botcazou
@ 2010-10-03 7:41 ` H.J. Lu
1 sibling, 0 replies; 3+ messages in thread
From: H.J. Lu @ 2010-10-03 7:41 UTC (permalink / raw)
To: Alexandre Oliva; +Cc: gcc-patches
On Wed, Jun 23, 2010 at 8:47 PM, Alexandre Oliva <aoliva@redhat.com> wrote:
> Interesting bug... All words of a multi-word variable ended up mapped
> to the same VALUE during cselib in var-tracking, and then their location
> was set to the same REG, that held only the first word.
>
> Problem was that we were initializing the variable within a loop, from
> an array element that lived in memory and varied per iteration of the
> loop. This means the MEM_OFFSETs couldn't be set: they weren't
> constant.
>
> Turns out that some recently-added code that attempted to simplify MEMs
> to something more palatable than complex expressions involving frame,
> stack or GOT pointers, mistook the absence of an offset for a zero
> offset. So, because of this delegitimization, each of the words loaded
> into part of the variable was regarded by cselib as a MEM referencing
> the first word of the array. Oops.
>
> This patch prevents the delegitimization when the offset is unknown, so
> that we don't get bogus equivalences.
>
> Regstrapped on x86_64-linux-gnu, i686-linux-gnu and ia64-linux-gnu.
>
This caused:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45870
--
H.J.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-10-03 7:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-24 9:50 [PR44610] don't delegitimize MEM from base without offset Alexandre Oliva
2010-06-25 9:45 ` Eric Botcazou
2010-10-03 7:41 ` H.J. Lu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).