[LLVMbugs] [Bug 19183] can't delete empty, terminating, strided loop
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Mar 25 12:49:42 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=19183
Richard Smith <richard-llvm at metafoo.co.uk> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|FIXED |---
--- Comment #2 from Richard Smith <richard-llvm at metafoo.co.uk> ---
Thanks!
Sadly, this isn't enough to clean up the mess left behind by the vectorizer
(presumably because the vectorization happens too late). This testcase still
leaves behind a do-nothing loop:
#include <memory>
#include <cstring>
long test(int iters, int len, int sticky)
{
const int block_size = 0x1000;
const int blocks = len / block_size;
std::unique_ptr<char[]> source(new char[blocks * block_size]);
std::unique_ptr<char[]> destination(new char[blocks * block_size]);
for (int i = 0; i < iters; ++i) {
char *psrc = source.get();
char *pdst = destination.get();
for (int block = 0; block < blocks; ++block) {
memcpy(psrc, pdst, block_size);
psrc += block_size;
pdst += block_size;
if (sticky) {
psrc -= block_size;
pdst -= block_size;
}
}
}
return long(iters) * blocks * block_size;
}
Running opt a second time on the output of clang -O3 -emit-llvm does remove the
do-nothing loop now, though.
(We should really be able to delete the entire function body, but that's a
separate issue...)
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140325/5d345c94/attachment.html>
More information about the llvm-bugs
mailing list