This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR60505
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Cong Hou <congh at google dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Richard Biener <rguenther at suse dot de>
- Date: Wed, 12 Mar 2014 09:24:59 +0100
- Subject: Re: [PATCH] Fix PR60505
- Authentication-results: sourceware.org; auth=none
- References: <CAK=A3=1eySj3DAFV+3=GSD6y9KxnMQ6SKUW9s43cybRN7PeBiw at mail dot gmail dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Tue, Mar 11, 2014 at 04:16:13PM -0700, Cong Hou wrote:
> This patch is fixing PR60505 in which the vectorizer may produce
> unnecessary epilogues.
>
> Bootstrapped and tested on a x86_64 machine.
>
> OK for trunk?
That looks wrong. Consider the case where the loop isn't versioned,
if you disable generation of the epilogue loop, you end up only with
a vector loop.
Say:
unsigned char ovec[16] __attribute__((aligned (16))) = { 0 };
void
foo (char *__restrict in, char *__restrict out, int num)
{
int i;
in = __builtin_assume_aligned (in, 16);
out = __builtin_assume_aligned (out, 16);
for (i = 0; i < num; ++i)
out[i] = (ovec[i] = in[i]);
out[num] = ovec[num / 2];
}
-O2 -ftree-vectorize. Now, consider if this function is called
with num != 16 (num > 16 is of course invalid, but num 0 to 15 is
valid and your patch will cause a wrong-code in this case).
Jakub