This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/82447] [IVOPTS] Consider removing cmp instruction while iterating on an array of known bound
- From: "amker at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 09 Oct 2017 15:25:45 +0000
- Subject: [Bug target/82447] [IVOPTS] Consider removing cmp instruction while iterating on an array of known bound
- Auto-submitted: auto-generated
- References: <bug-82447-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82447
--- Comment #6 from amker at gcc dot gnu.org ---
(In reply to Jakub Jelinek from comment #5)
> (In reply to amker from comment #4)
> > (In reply to Jakub Jelinek from comment #2)
> > > Indeed. But when the body is:
> > > sum += a[size - 1 - i];
> > > while base 128U with step -1U is considered, it isn't found as the cheapest
> > > for some reason either.
> >
> > On 64-bit targets, candidate [128, -1] is added in unsigned int type, while
> > address IV has pointer type. IVOPTs simply skips the candidate because it
> > has smaller precision than the IV use.
>
> Yeah, but can't we also add [128UL, -1UL] candidate if we see there are IVs
> of that bitsize? Conversion from that to the unsigned int IV is cheap.
Yes we can. For constant niters loop, currently it's ivcanon adding the
counting down IV, I mentioned during cauldron that we may want to get rid of
iv_canonicalization by adding all necessary IV candidates in IVOTPs.