Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Clang punts on vectorization and issues incorrect diagnostic #33096

Open Quuxplusone opened 7 years ago

Quuxplusone commented 7 years ago
Bugzilla Link PR34125
Status NEW
Importance P enhancement
Reported by Jeff Hammond (jeff.science@gmail.com)
Reported on 2017-08-08 13:57:46 -0700
Last modified on 2017-08-08 14:01:57 -0700
Version 4.0
Hardware Macintosh MacOS X
CC hfinkel@anl.gov, jeff.science@gmail.com, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments make.log (16721 bytes, text/plain)
stencil-vector-tbb.tar.gz (5466 bytes, application/x-gzip)
Blocks
Blocked by
See also
Created attachment 18948
make command output

Clang claims the reason it does not vectorize star[45] is because the trip
count cannot be determined, but the trip count determination is identical in
star[123], which are vectorized.

./stencil_tbb.hpp:63:7: remark: loop not vectorized: could not determine number
of loop iterations [-Rpass-analysis]
      for (auto j=r.cols().begin(); j!=r.cols().end(); ++j ) {
      ^

As best I can tell, the issue is that the loop bodies for star[45] are too
large.  Functions with 12 or fewer terms are vectorized whereas those with 16
or more are not.
Quuxplusone commented 7 years ago

Attached make.log (16721 bytes, text/plain): make command output

Quuxplusone commented 7 years ago

Attached stencil-vector-tbb.tar.gz (5466 bytes, application/x-gzip): archive containing reproducer

Quuxplusone commented 7 years ago
I use Clang 4.0.1 from Homebrew:

$ /usr/local/Cellar/llvm/4.0.1/bin/clang++ --version
clang version 4.0.1 (tags/RELEASE_401/final)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /usr/local/Cellar/llvm/4.0.1/bin