This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/50661] std::equal should use more efficient version for arrays of pointers
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 08 Oct 2011 12:20:34 +0000
- Subject: [Bug libstdc++/50661] std::equal should use more efficient version for arrays of pointers
- Auto-submitted: auto-generated
- References: <bug-50661-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50661
--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-10-08 12:20:34 UTC ---
One possibility would be some fallthru hint to the compiler similar to
__builtin_assume_aligned that would tell the compiler that certain range of
bytes will not trap/fault on reading and thus it is safe to read it
speculatively.
ptr = __builtin_assume_object_size (ptr, length);
or similar. You could just insert it before the loop and let it be vectorized.
But I believe we don't vectorize even
void *array1[1024], *array2[1024];
int foo (void)
{
int i;
for (i = 0; i < 1024; i++)
if (array1[i] != array2[i])
break;
return i == n;
}
where the will not fault/trap for i 0 .. 1023 is already known (or can be
known).