This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Re-run of loop pass
- To: m dot hayes at elec dot canterbury dot ac dot nz
- Subject: Re: Re-run of loop pass
- From: Mark Mitchell <mark at markmitchell dot com>
- Date: Sun, 18 Oct 1998 11:24:38 -0700
- CC: law at cygnus dot com, m dot hayes at elec dot canterbury dot ac dot nz, egcs at cygnus dot com
- References: <"13865.9178.455954.70561"@ongaonga.elec.canterbury.ac.nz><18798.908694891@hurl.cygnus.com> <13865.44885.953349.460182@ongaonga.elec.canterbury.ac.nz>
- Reply-to: mark at markmitchell dot com
>>>>> "Michael" == Michael Hayes <m.hayes@elec.canterbury.ac.nz> writes:
Michael> The first pass often eliminates the BIV associated with i
Michael> and replaces the end of loop test i < 4 with a comparison
Michael> of the incremented pointer associated with a + i with a +
Michael> 4 (I think the elimination is only performed for targets
Michael> with autoincrement addressing modes). The second pass
Michael> then finds that the initial value of BIV associated with
Michael> a is not a constant and thus cannot determine the
Michael> iteration count.
Or the second pass could learn to recongize some of these idioms.
For example, you seem to imply that if I write:
int* i;
int* j;
for (i = j ; i < j + 4; ++j)
;
say, that loop can't figure out the number of iterations. A little
algebra might be helpful here, since this is a reasonably common
idiom, especially in C++ using STL, and especially where `4' is
replaced by `k'. So much so that if no-one else does this, I'll
probably get around to it.
--
Mark Mitchell mark@markmitchell.com
Mark Mitchell Consulting http://www.markmitchell.com