public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/65330] New: restrict should be considered when folding through references from global vars
@ 2015-03-05 19:56 hubicka at gcc dot gnu.org
  2015-03-05 20:29 ` [Bug middle-end/65330] " hubicka at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: hubicka at gcc dot gnu.org @ 2015-03-05 19:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65330

            Bug ID: 65330
           Summary: restrict should be considered when folding through
                    references from global vars
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hubicka at gcc dot gnu.org

In the following testcase the restrict should be taken into account when
folding testrestrict.

const int *varptr=&var;
const int *__restrict__ varptr2=&var;

 int *__restrict__ varptr3 = &var;
 int *__restrict__ varptr4 = &var;

int *
return_valptr(int i)
{
  return varptr[i];
}
int * __restrict__
return_valptr2(int i)
{
  return varptr2[i];
}
int
testrestrict ()
{
  int *ptr = return_valptr (0);
  *ptr = 0;
  *varptr3 = 1;
  return *ptr;
}
int
testrestrict2 ()
{
  int *ptr = return_valptr2 (0);
  *ptr = 0;
  *varptr3 = 1;
  return *ptr;
}
int
testrestrict4 ()
{
  *varptr4 = 0;
  *varptr3 = 1;
  return *varptr4;
}


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug middle-end/65330] restrict should be considered when folding through references from global vars
  2015-03-05 19:56 [Bug middle-end/65330] New: restrict should be considered when folding through references from global vars hubicka at gcc dot gnu.org
@ 2015-03-05 20:29 ` hubicka at gcc dot gnu.org
  2015-03-06 10:07 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: hubicka at gcc dot gnu.org @ 2015-03-05 20:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65330

Jan Hubicka <hubicka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1
         Depends on|                            |65270
           Severity|normal                      |enhancement

--- Comment #1 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
To make this work, ICF most probably must not merge variables with mismatching
restrict qualifiers.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug middle-end/65330] restrict should be considered when folding through references from global vars
  2015-03-05 19:56 [Bug middle-end/65330] New: restrict should be considered when folding through references from global vars hubicka at gcc dot gnu.org
  2015-03-05 20:29 ` [Bug middle-end/65330] " hubicka at gcc dot gnu.org
@ 2015-03-06 10:07 ` rguenth at gcc dot gnu.org
  2015-03-07  0:08 ` hubicka at ucw dot cz
  2015-03-09 13:55 ` rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-03-06 10:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65330

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
           Priority|P1                          |P3
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2015-03-06
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
I was thinking of sth else first - make sure that points-to analysis processes
initializers of readonly globals (when they bind to the current def).  In
your testcase the globals are not readonly - or did you mean to write

int * const varptr = &var;
int * const __restrict__ varptr2 = &var;

?  Your testcase also misses a declaration of 'var'.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug middle-end/65330] restrict should be considered when folding through references from global vars
  2015-03-05 19:56 [Bug middle-end/65330] New: restrict should be considered when folding through references from global vars hubicka at gcc dot gnu.org
  2015-03-05 20:29 ` [Bug middle-end/65330] " hubicka at gcc dot gnu.org
  2015-03-06 10:07 ` rguenth at gcc dot gnu.org
@ 2015-03-07  0:08 ` hubicka at ucw dot cz
  2015-03-09 13:55 ` rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: hubicka at ucw dot cz @ 2015-03-07  0:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65330

--- Comment #3 from Jan Hubicka <hubicka at ucw dot cz> ---
> I was thinking of sth else first - make sure that points-to analysis processes
> initializers of readonly globals (when they bind to the current def).  In
when ctor_for_folding returns non-NULL;
> your testcase the globals are not readonly - or did you mean to write
> 
> int * const varptr = &var;
> int * const __restrict__ varptr2 = &var;
> 
> ?  Your testcase also misses a declaration of 'var'.

I did not quite finish the testcase because the restrict qualifier I was
interested in was ignored.  Yes, they would need to be declared either const or
static (so the DECL_READONLY is derived by IPA code).

This should be full testcase (-fmerge-all-constants is needed to get merging
done, but to expose any problems testrestrict/testrestrict2 codegen would need
to differ):

int var;
static const int *varptr=&var;
static const int *__restrict__ varptr2=&var;
static int *__restrict__ varptr3 = &var;
static int *__restrict__ varptr4 = &var;
int *
return_valptr(int i)
{
  return varptr[i];
}
int * __restrict__
return_valptr2(int i)
{
  return varptr2[i];
}
int
testrestrict ()
{
  int *ptr = return_valptr (0);
  *ptr = 0;
  *varptr3 = 1;
  return *ptr;
}
int
testrestrict2 ()
{
  int *ptr = return_valptr2 (0);
  *ptr = 0;
  *varptr3 = 1;
  return *ptr;
}
int
testrestrict4 ()
{
  *varptr4 = 0;
  *varptr3 = 1;
  return *varptr4;
}


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug middle-end/65330] restrict should be considered when folding through references from global vars
  2015-03-05 19:56 [Bug middle-end/65330] New: restrict should be considered when folding through references from global vars hubicka at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2015-03-07  0:08 ` hubicka at ucw dot cz
@ 2015-03-09 13:55 ` rguenth at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-03-09 13:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65330
Bug 65330 depends on bug 65270, which changed state.

Bug 65270 Summary: [5 regression] issues with merging memory accesses from different code paths
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65270

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-03-09 13:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-05 19:56 [Bug middle-end/65330] New: restrict should be considered when folding through references from global vars hubicka at gcc dot gnu.org
2015-03-05 20:29 ` [Bug middle-end/65330] " hubicka at gcc dot gnu.org
2015-03-06 10:07 ` rguenth at gcc dot gnu.org
2015-03-07  0:08 ` hubicka at ucw dot cz
2015-03-09 13:55 ` rguenth at gcc dot gnu.org

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).