Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Equivalent of -ftree-vectorizer-verbose for clang

Tags:

clang

clang++

The question is about how to make clang print information on which loops (or other parts of code) have been vectorized. GCC has a command line switch named -ftree-vectorizer-verbose=6 to do this (or -fopt-info-vec in newer versions of GCC), but I couldn't find anything similar for clang. Does clang support this or my only option is to peek in the disassembly ?

like image 874
jcxz Avatar asked Jul 10 '13 16:07

jcxz


People also ask

Is GCC or Clang better?

Clang is much faster and uses far less memory than GCC. Clang aims to provide extremely clear and concise diagnostics (error and warning messages), and includes support for expressive diagnostics. GCC's warnings are sometimes acceptable, but are often confusing and it does not support expressive diagnostics.

Is LLVM same as Clang?

Clang is an "LLVM native" C/C++/Objective-C compiler, which aims to deliver amazingly fast compiles, extremely useful error and warning messages and to provide a platform for building great source level tools.

Will GCC be replaced by Clang?

Clang is a compiler front end for the C, C++, Objective-C, and Objective-C++ programming languages, as well as the OpenMP, OpenCL, RenderScript, CUDA, and HIP frameworks. It acts as a drop-in replacement for the GNU Compiler Collection (GCC), supporting most of its compilation flags and unofficial language extensions.

Is Clang a C++ compiler?

clang is a C, C++, and Objective-C compiler which encompasses preprocessing, parsing, optimization, code generation, assembly, and linking.


2 Answers

clang has following options to print diagnostics related to vectorization:

-Rpass=loop-vectorize identifies loops that were successfully vectorized.

-Rpass-missed=loop-vectorize identifies loops that failed vectorization and indicates if vectorization was specified.

-Rpass-analysis=loop-vectorize identifies the statements that caused vectorization to fail.

Source: http://llvm.org/docs/Vectorizers.html

like image 114
A. K. Avatar answered Oct 30 '22 22:10

A. K.


Looking through the clang source code, there are a couple vectorization passes in Transforms/Vectorize:

  • BBVectorize
  • LoopVectorize
  • SLPVectorize

The last three don't seem to have any arguments that will print things. But in inside BBVectorize there are a couple of options for printing things when clang is built debug:

  • bb-vectorize-debug-instruction-examination - When debugging is enabled, output information on the instruction-examination process
  • bb-vectorize-debug-candidate-selection - When debugging is enabled, output information on the candidate-selection process
  • bb-vectorize-debug-pair-selection - When debugging is enabled, output information on the pair-selection process
  • bb-vectorize-debug-cycle-check - When debugging is enabled, output information on the cycle-checking process
  • bb-vectorize-debug-print-after-every-pair -When debugging is enabled, dump the basic block after every pair is fused

That looks like it's about it.

like image 35
razeh Avatar answered Oct 30 '22 23:10

razeh