public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/35360]  New: Static (base/offset/size rule) should be extended to handle array  elements
@ 2008-02-25  5:20 xinliangli at gmail dot com
  2008-02-25 11:45 ` [Bug middle-end/35360] " rguenth at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: xinliangli at gmail dot com @ 2008-02-25  5:20 UTC (permalink / raw)
  To: gcc-bugs

// David Li
the two references in the loop are not aliased. Not optimized by gcc

struct A{
 int a;
 int b;
};

struct A aa[100];


void foo(int n, int i, int j)
{
  int k = 0;
  for (k = 0; k < n; k++)
  {
      aa[i].a += aa[j].b;
  }
}


-- 
           Summary: Static (base/offset/size rule) should be extended to
                    handle array  elements
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: xinliangli at gmail dot com


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


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

* [Bug middle-end/35360] Static (base/offset/size rule) should be extended to handle array  elements
  2008-02-25  5:20 [Bug middle-end/35360] New: Static (base/offset/size rule) should be extended to handle array elements xinliangli at gmail dot com
@ 2008-02-25 11:45 ` rguenth at gcc dot gnu dot org
  2008-03-14 21:29 ` rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-02-25 11:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2008-02-25 11:44 -------
Confirmed.  MEM_REF might help here as we'd get

  off_1 = IDX <0 + i * 8>
  MEM_REF <aa, off_1>

and

  off_2 = IDX <4 + j * 8>
  MEM_REF <aa, off_2>

where the alias-oracle should be able to see that the accesses cannot overlap.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu dot
                   |                            |org
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |alias, missed-optimization
   Last reconfirmed|0000-00-00 00:00:00         |2008-02-25 11:44:45
               date|                            |
            Version|unknown                     |4.3.0


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


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

* [Bug middle-end/35360] Static (base/offset/size rule) should be extended to handle array elements
  2008-02-25  5:20 [Bug middle-end/35360] New: Static (base/offset/size rule) should be extended to handle array elements xinliangli at gmail dot com
  2008-02-25 11:45 ` [Bug middle-end/35360] " rguenth at gcc dot gnu dot org
@ 2008-03-14 21:29 ` rguenth at gcc dot gnu dot org
  2009-04-03 12:32 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-03-14 21:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2008-03-14 21:29 -------
Zdeneks lim/store-motion rewrite should help as well.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Static (base/offset/size    |Static (base/offset/size
                   |rule) should be extended to |rule) should be extended to
                   |handle array  elements      |handle array elements


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


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

* [Bug middle-end/35360] Static (base/offset/size rule) should be extended to handle array elements
  2008-02-25  5:20 [Bug middle-end/35360] New: Static (base/offset/size rule) should be extended to handle array elements xinliangli at gmail dot com
  2008-02-25 11:45 ` [Bug middle-end/35360] " rguenth at gcc dot gnu dot org
  2008-03-14 21:29 ` rguenth at gcc dot gnu dot org
@ 2009-04-03 12:32 ` rguenth at gcc dot gnu dot org
  2009-06-09  2:40 ` pinskia at gcc dot gnu dot org
  2010-07-13 10:55 ` steven at gcc dot gnu dot org
  4 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-04-03 12:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2009-04-03 12:32 -------
Re-confirmed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2008-02-25 11:44:45         |2009-04-03 12:32:48
               date|                            |


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


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

* [Bug middle-end/35360] Static (base/offset/size rule) should be extended to handle array elements
  2008-02-25  5:20 [Bug middle-end/35360] New: Static (base/offset/size rule) should be extended to handle array elements xinliangli at gmail dot com
                   ` (2 preceding siblings ...)
  2009-04-03 12:32 ` rguenth at gcc dot gnu dot org
@ 2009-06-09  2:40 ` pinskia at gcc dot gnu dot org
  2010-07-13 10:55 ` steven at gcc dot gnu dot org
  4 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-06-09  2:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2009-06-09 02:40 -------
Here is another testcase that depends on PRE/FRE (really VN) getting the more
correct answer:
struct A{
 int a;
 int b;
};

struct A aa[100];


void foo(int n, int i, int j)
{
  aa[j].a = 0;
  aa[i].b = 1;
  if (aa[j].a != 0)
    link_error();
}


-- 


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


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

* [Bug middle-end/35360] Static (base/offset/size rule) should be extended to handle array elements
  2008-02-25  5:20 [Bug middle-end/35360] New: Static (base/offset/size rule) should be extended to handle array elements xinliangli at gmail dot com
                   ` (3 preceding siblings ...)
  2009-06-09  2:40 ` pinskia at gcc dot gnu dot org
@ 2010-07-13 10:55 ` steven at gcc dot gnu dot org
  4 siblings, 0 replies; 7+ messages in thread
From: steven at gcc dot gnu dot org @ 2010-07-13 10:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from steven at gcc dot gnu dot org  2010-07-13 10:55 -------
Test case of comment #4 still fails with r162134.

Not sure what is expected for the test case of comment #0, but I'm assuming the
point is that the store of the reduction should be sunk. That doesn't happen as
of r162134, this is what comes out of the compiler at -O3:


;; Function foo (foo)

Removing basic block 6
foo (int n, int i, int j)
{
  int prephitmp.3;
  int k;
  int D.1988;

<bb 2>:
  if (n_4(D) > 0)
    goto <bb 3>;
  else
    goto <bb 5>;

<bb 3>:
  prephitmp.3_14 = aa[i_5(D)].a;

<bb 4>:
  # k_16 = PHI <k_10(4), 0(3)>
  # prephitmp.3_18 = PHI <prephitmp.3_9(4), prephitmp.3_14(3)>
  D.1988_8 = aa[j_7(D)].b;
  prephitmp.3_9 = prephitmp.3_18 + D.1988_8;
  aa[i_5(D)].a = prephitmp.3_9;
  k_10 = k_16 + 1;
  if (k_10 != n_4(D))
    goto <bb 4>;
  else
    goto <bb 5>;

<bb 5>:
  return;

}


-- 

steven at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2009-04-03 12:32:48         |2010-07-13 10:55:27
               date|                            |


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


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

* [Bug middle-end/35360] Static (base/offset/size rule) should be extended to handle array elements
       [not found] <bug-35360-4@http.gcc.gnu.org/bugzilla/>
@ 2021-07-26  9:02 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-26  9:02 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.9.0
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Both testcases are fixed in 4.9.0 by r0-122892 and there was a few testcases
added that were similar to this bug report already.

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

end of thread, other threads:[~2021-07-26  9:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-25  5:20 [Bug middle-end/35360] New: Static (base/offset/size rule) should be extended to handle array elements xinliangli at gmail dot com
2008-02-25 11:45 ` [Bug middle-end/35360] " rguenth at gcc dot gnu dot org
2008-03-14 21:29 ` rguenth at gcc dot gnu dot org
2009-04-03 12:32 ` rguenth at gcc dot gnu dot org
2009-06-09  2:40 ` pinskia at gcc dot gnu dot org
2010-07-13 10:55 ` steven at gcc dot gnu dot org
     [not found] <bug-35360-4@http.gcc.gnu.org/bugzilla/>
2021-07-26  9:02 ` 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).