public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/19347] New: Invariant load not moved out of loop
@ 2005-01-09 10:51 irar at il dot ibm dot com
  2005-01-09 15:55 ` [Bug tree-optimization/19347] " pinskia at gcc dot gnu dot org
  2005-04-11  6:10 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 7+ messages in thread
From: irar at il dot ibm dot com @ 2005-01-09 10:51 UTC (permalink / raw)
  To: gcc-bugs

In mesa benchmark (osmesa.c:678) 

         GLuint i, n, *ptr4;
         n = osmesa->rowlength * osmesa->height;
         ptr4 = (GLuint *) osmesa->buffer;
         for (i=0;i<n;i++) {
            *ptr4++ = osmesa->clearpixel;
         }   

The load of osmesa->clearpixel is not taken outside the loop by LIM because of 
aliasing limitations. This in turn also prevents vectorization.

In this particular case we can actually get the load moved out of the loop even 
without resolving the aliasing issue (which requires whole-program), on 
account that even if the store aliases the load, it will not alter the value 
loaded (because we store the same value that we loaded).

I'm looking into this in the context of the vectorizer.

-- 
           Summary: Invariant load not moved out of loop
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: irar at il dot ibm dot com
        ReportedBy: irar at il dot ibm dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: powerpc-apple-darwin7.0.0
  GCC host triplet: powerpc-apple-darwin7.0.0
GCC target triplet: powerpc-apple-darwin7.0.0


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


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

* [Bug tree-optimization/19347] Invariant load not moved out of loop
  2005-01-09 10:51 [Bug tree-optimization/19347] New: Invariant load not moved out of loop irar at il dot ibm dot com
@ 2005-01-09 15:55 ` pinskia at gcc dot gnu dot org
  2005-04-11  6:10 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-09 15:55 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-09 15:55 -------
Confirmed but add a full testcase here, thanks.

Actually I don't think it would require whole program analysis to do this in LIM (or LICM), we just need 
more information (which might be done on the structure-aliasing branch).

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |missed-optimization
   Last reconfirmed|0000-00-00 00:00:00         |2005-01-09 15:55:15
               date|                            |


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


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

* [Bug tree-optimization/19347] Invariant load not moved out of loop
  2005-01-09 10:51 [Bug tree-optimization/19347] New: Invariant load not moved out of loop irar at il dot ibm dot com
  2005-01-09 15:55 ` [Bug tree-optimization/19347] " pinskia at gcc dot gnu dot org
@ 2005-04-11  6:10 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-11  6:10 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
   Last reconfirmed|2005-01-09 15:55:15         |2005-04-11 06:09:59
               date|                            |


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


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

* [Bug tree-optimization/19347] Invariant load not moved out of loop
       [not found] <bug-19347-4@http.gcc.gnu.org/bugzilla/>
  2024-01-03 19:14 ` phosit at autistici dot org
@ 2024-01-03 19:35 ` phosit at autistici dot org
  1 sibling, 0 replies; 7+ messages in thread
From: phosit at autistici dot org @ 2024-01-03 19:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Phosit <phosit at autistici dot org> ---
The analysis in my previous comment is wrong.
I don't know why there is no alias-check at -O2.
Also the loop _is_ removed at -O3.

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

* [Bug tree-optimization/19347] Invariant load not moved out of loop
       [not found] <bug-19347-4@http.gcc.gnu.org/bugzilla/>
@ 2024-01-03 19:14 ` phosit at autistici dot org
  2024-01-03 19:35 ` phosit at autistici dot org
  1 sibling, 0 replies; 7+ messages in thread
From: phosit at autistici dot org @ 2024-01-03 19:14 UTC (permalink / raw)
  To: gcc-bugs

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

Phosit <phosit at autistici dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |phosit at autistici dot org

--- Comment #9 from Phosit <phosit at autistici dot org> ---
When there are few iterations (likely when it is unroled) there is no
alias-check:

void fill(int* data, int& value)
{
    for(unsigned long i{0}; i != 4; ++i)
        data[i] = value;
}

--- at -O2 results in:
fill(int*, int&):
        movd    xmm1, DWORD PTR [rsi]
        pshufd  xmm0, xmm1, 0xe0
        movq    QWORD PTR [rdi], xmm0
        movd    xmm0, DWORD PTR [rsi]
        pshufd  xmm0, xmm0, 0xe0
        movq    QWORD PTR [rdi+8], xmm0
        ret

---
At -O3 the loop isn't removed and (thus) there is an alias-check.

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

* [Bug tree-optimization/19347] Invariant load not moved out of loop
       [not found] <bug-19347-9531@http.gcc.gnu.org/bugzilla/>
  2005-10-24  0:20 ` pinskia at gcc dot gnu dot org
@ 2009-04-03 12:06 ` rguenth at gcc dot gnu dot org
  1 sibling, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-04-03 12:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenth at gcc dot gnu dot org  2009-04-03 12:06 -------
The store to *ptr aliases the load from osmesa->clearpixel - there
is no (easy) way to otherwise prove that it is not (at least with the
testcase).
We do not see where osmesa->buffer points to (it may point to
&osmesa->clearpixel).


-- 


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


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

* [Bug tree-optimization/19347] Invariant load not moved out of loop
       [not found] <bug-19347-9531@http.gcc.gnu.org/bugzilla/>
@ 2005-10-24  0:20 ` pinskia at gcc dot gnu dot org
  2009-04-03 12:06 ` rguenth at gcc dot gnu dot org
  1 sibling, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-24  0:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2005-10-24 00:20 -------
This is the normal, we need offset/varaible aliasing.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dberlin at gcc dot gnu dot
                   |                            |org
           Keywords|                            |alias
   Last reconfirmed|2005-05-04 18:15:55         |2005-10-24 00:20:32
               date|                            |


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


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

end of thread, other threads:[~2024-01-03 19:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-09 10:51 [Bug tree-optimization/19347] New: Invariant load not moved out of loop irar at il dot ibm dot com
2005-01-09 15:55 ` [Bug tree-optimization/19347] " pinskia at gcc dot gnu dot org
2005-04-11  6:10 ` pinskia at gcc dot gnu dot org
     [not found] <bug-19347-9531@http.gcc.gnu.org/bugzilla/>
2005-10-24  0:20 ` pinskia at gcc dot gnu dot org
2009-04-03 12:06 ` rguenth at gcc dot gnu dot org
     [not found] <bug-19347-4@http.gcc.gnu.org/bugzilla/>
2024-01-03 19:14 ` phosit at autistici dot org
2024-01-03 19:35 ` phosit at autistici dot 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).