public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/49761] New: restrict keyword ignored if in structure
@ 2011-07-16  9:52 vincenzo.innocente at cern dot ch
  2011-07-18  8:52 ` [Bug tree-optimization/49761] " rguenth at gcc dot gnu.org
  2021-09-12 16:30 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: vincenzo.innocente at cern dot ch @ 2011-07-16  9:52 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49761

           Summary: restrict keyword ignored if in structure
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: vincenzo.innocente@cern.ch


in this example no alias checks are generated for the first function while
there are generated when inlined in the second and third functions.

Is it correct to declare an array "restricted" in a structure?

compiled with 
c++ -Wall -ftree-vectorizer-verbose=7 -Ofast -c 
gcc version 4.7.0 20110528 (experimental) (GCC) 

struct SoA {
  int *  __restrict__ a;
  float * __restrict__ b;
  float * __restrict__ c;
  int size;
};

struct SoB {
  int *  __restrict__ a;
  float * __restrict__ b;
  int size;
};

void loop(  int const *  __restrict__ in_a, 
        float const * __restrict__ in_b,
        float const * __restrict__ in_c,
        int *  __restrict__ out_a,
        float * __restrict__ out_b,
        int N, int & k) {
  int j=k;
  for (int i=0; i!=N; ++i) {
    out_b[j] = in_c[i]+in_b[i];
    out_a[j] = in_a[i];
   ++ j;
  }
  k = j;
}


void loop2(SoA const & in, SoB & out, int & k) {
  loop(in.a,in.b,in.c,
       out.a,out.b, 
       in.size, k);
}

void loop3(SoA const & in, SoB & out, int & k) {
  int j=k;
  int N=in.size;
  for (int i=0; i!=N; ++i) {
    out.b[j] = in.c[i]+in.b[i];
    out.a[j] = in.a[i];
    ++j;
  }
  k = j;
}


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

* [Bug tree-optimization/49761] restrict keyword ignored if in structure
  2011-07-16  9:52 [Bug tree-optimization/49761] New: restrict keyword ignored if in structure vincenzo.innocente at cern dot ch
@ 2011-07-18  8:52 ` rguenth at gcc dot gnu.org
  2021-09-12 16:30 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-07-18  8:52 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49761

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.07.18 08:51:48
     Ever Confirmed|0                           |1

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-07-18 08:51:48 UTC ---
Yes, you can declare an array restricted in a structure.  GCC will however
not be able to track this for anonymous storage.


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

* [Bug tree-optimization/49761] restrict keyword ignored if in structure
  2011-07-16  9:52 [Bug tree-optimization/49761] New: restrict keyword ignored if in structure vincenzo.innocente at cern dot ch
  2011-07-18  8:52 ` [Bug tree-optimization/49761] " rguenth at gcc dot gnu.org
@ 2021-09-12 16:30 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-12 16:30 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
           Severity|major                       |enhancement

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

end of thread, other threads:[~2021-09-12 16:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-16  9:52 [Bug tree-optimization/49761] New: restrict keyword ignored if in structure vincenzo.innocente at cern dot ch
2011-07-18  8:52 ` [Bug tree-optimization/49761] " rguenth at gcc dot gnu.org
2021-09-12 16:30 ` pinskia 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).