Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Rpass-analysis=loop-vectorize warns on source locations that are not in the preprocessed file #26715

Open Quuxplusone opened 8 years ago

Quuxplusone commented 8 years ago
Bugzilla Link PR26716
Status NEW
Importance P normal
Reported by Gonzalo BG (gonzalo.gadeschi@gmail.com)
Reported on 2016-02-23 11:46:37 -0800
Last modified on 2016-03-03 11:03:51 -0800
Version trunk
Hardware All All
CC echristo@gmail.com, hfinkel@anl.gov, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments preprocessed.i.lzma (850602 bytes, application/x-lzma)
Blocks
Blocked by
See also

In a nutshell, I have a huge piece of code and was looking at the vectorization analysis from -Rpass-analysis=loop-vectorize which produces a lot of output.

So I went on an ifdefed some large chunk of code out (my program still compiles fine).

I get a couple of warnings by Rpass analysis that some loop cannot be vectorized, but to my surprise it points to a line (and shows the line) within the ifdefed out code.

First thought was, generate the preprocessed sources, delta it, and submit a bug but... since the code is ifdefed out, the error cannot be reproduced from the preprocessed sources.

I've been trying to come up with a minimal example that reproduces it for half an hour without any luck. So this is all I got.

Quuxplusone commented 8 years ago
So I just made some progress with -frewrite-includes which basically just
includes the includes but leaves all other macros intact. I get results of the
form:

/usr/lib64/gcc/x86_64-suse-linux/4.9/../../../../include/c++/4.9/cstddef:11:1:
remark: loop not vectorized: vectorization is not beneficial and is not
explicitly forced
      [-Rpass-analysis=loop-vectorize]
// This library is distributed in the hope that it will be useful,
^
/usr/lib64/gcc/x86_64-suse-linux/4.9/../../../../include/c++/4.9/cstddef:21:1:
remark: loop not vectorized: vectorization is not beneficial and is not
explicitly forced
      [-Rpass-analysis=loop-vectorize]
// a copy of the GCC Runtime Library Exception along with this program;
Quuxplusone commented 8 years ago
So with the fully preprocessed file using -frewrite-includes i get the error at
least twice, but i also get a lot of

note: could not determine the original source location for ...

is there a way to fix them in the preprocessed file? The whole source code is
within that file but there is a lot of noise:

#if 0 /* expanded by -frewrite-includes */
#include <cstddef>
#endif /* expanded by -frewrite-includes */
# 123 "/usr/lib64/gcc/x86_64-suse-
linux/4.9/../../../../include/c++/4.9/cstddef" 1 3
// -*- C++ -*- forwarding header.

which might be giving trouble to clang.

I've given up in trying to generate a test case by hand.
Quuxplusone commented 8 years ago

@Hal I can add a 400k LOC preprocessed source file that reproduces this issue a couple of times if you want to look into it.

Quuxplusone commented 8 years ago
(In reply to comment #3)
> @Hal I can add a 400k LOC preprocessed source file that reproduces this
> issue a couple of times if you want to look into it.

You might want to attach it compressed (I don't recall what the file-size
upload limit is).
Quuxplusone commented 8 years ago

Any sort of testcase would be useful, yes. :)

Quuxplusone commented 8 years ago

Attached preprocessed.i.lzma (850602 bytes, application/x-lzma): Preprocessed sources of program that reproduces the errors