This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: missed optimization, would be very helpful


Zack Weinberg <zack@rabi.columbia.edu> writes:

|> On 06 Jan 1999 10:56:04 +0100, Andreas Schwab wrote:
|> >Zack Weinberg <zack@rabi.columbia.edu> writes:
|> >
|> >|> In a loop of the form
|> >|> 
|> >|> while (condition) (*int_ptr)++;
|> >|> 
|> >|> gcc generates a read-mod-write cycle to the memory location *int_ptr at
|> >|> each iteration of the loop.
|> [...]
|> >|> (If anyone wants an example, look at cpplib.c:adjust_position.)
|> >
|> >This is a bad example, because linep and colp may alias each other, and a
|> >char * can alias everything.
|> 
|> I forgot about that - but even this:
|> 
|> void fun (int *__restrict ctr, char *__restrict str)
|> {
|>     while (*str++) (*ctr)++;
|> }
|> 
|> compiles to an incl of memory, on x86.

Does egcs already implement restrict to its full extent?

Andreas.

-- 
Andreas Schwab                                      "And now for something
schwab@issan.cs.uni-dortmund.de                      completely different"
schwab@gnu.org


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]