This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/33707] missed optimization with dependency checker
- From: "sebpop at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Nov 2007 06:31:32 -0000
- Subject: [Bug tree-optimization/33707] missed optimization with dependency checker
- References: <bug-33707-12191@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from sebpop at gmail dot com 2007-11-03 06:31 -------
Subject: Re: New: missed optimization with dependency checker
> int
> foo (char *a, unsigned n)
> {
> int i;
> a[0] = 0;
> for (i = 16; i < n; i++)
> a[i] = a[i-16];
> }
>
We're failing to analyse the base of the array 'a' for this code, as
there is a cast from "signed int" to "unsigned int" for the main iv:
# i.0D.1181_20 = PHI <i.0D.1181_4(5), 16(3)>
# iD.1177_19 = PHI <iD.1177_12(5), 16(3)>
D.1182_7 = aD.1173_2(D) + i.0D.1181_20;
iD.1177_12 = iD.1177_19 + 1;
i.0D.1181_4 = (unsigned intD.3) iD.1177_12;
if (i.0D.1181_4 < nD.1174_5(D))
This is due to the fact that we have to convert 'i' to unsigned before
comparing with 'n'. The exact same testcase with just a signed type
for 'n' is vectorized:
int
foo (char *a, int n)
{
int i;
a[0] = 0;
for (i = 16; i < n; i++)
a[i] = a[i-16];
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33707