Why doesn't GCC show vectorization information?
Asked Answered
M

3

20

I'm using Codeblocks for a C program on Windows 7. The program is using the OMP library. GCC version is 4.9.2. Mingw x86_64-w64-mingw32-gcc-4.9.2.exe.

Flags used are: -fopenmp -O3 -mfpmath=sse -funroll-loops -ftree-loop-distribution -ftree-vectorize -ftree-vectorizer-verbose=2.

The program runs correctly but the problem is that it doesn't show information on what loops were vectorized or not. How can I solve it?

Build log info:

-------------- Build: Release in **** (compiler: GNU GCC Compiler)---------------

x86_64-w64-mingw32-gcc-4.9.2.exe -Wall -O2 -march=corei7 -fexpensive-optimizations -O3 -fopenmp -mfpmath=sse -funroll-loops -ftree-loop-distribution -ftree-vectorize -ftree-vectorizer-verbose=2 -c C:\Users...\f.c -o obj\Release\f.o x86_64-w64-mingw32-g++.exe -o bin\Release\d.exe obj\Release\f.o obj\Release\main.o -s "C:\Program Files...\libgomp-1.dll" Output file is bin\Release\d.exe with size 21.00 KB Process terminated with status 0 (0 minute(s), 0 second(s)) 0 error(s), 0 warning(s) (0 minute(s), 0 second(s))

Mislay answered 17/11, 2015 at 14:7 Comment(0)
C
33

CodeBlocks is an IDE. It doesn't compile anything. GCC does. The -ftree-vectorizer-verbose used to work in previous versions. Now there's -fopt-info, which allows to retrieve information about optimizations (vectorization too); you can find the relevant documentation here.

It is even shown how to actually retrieve the vectorizer output to stderr: and this one:

gcc -O2 -ftree-vectorize -fopt-info-vec-missed 

prints information about missed optimization opportunities from vectorization passes on stderr. Note that -fopt-info-vec-missed is equivalent to -fopt-info-missed-vec.

You can change missed to e.g. optimized, all and so on as listed.

Client answered 17/11, 2015 at 15:30 Comment(3)
Now it works. Before changing compiler, I had that kind of info and then I couldn't retrieve them again.Mislay
An example flag that achieves this would be welcome... the man page for fopt-info family of options is a bit hard to grok.Typist
@AndrewWagner I've checked the docs again and it seems to have changed since I've posted the answer, so I've updated the link and added a bit more explanation.Client
K
5

The gcc flag -ftree-vectorizer-verbose has been deprecated in gcc 4.9. In newer versions of GCC you can use -fopt-info-vec-missed.

See https://github.com/gcc-mirror/gcc/blob/releases/gcc-4.9/gcc/common.opt

ftree-vectorizer-verbose= Common Joined RejectNegative Ignore Does nothing. Preserved for backward compatibility.

Kikelia answered 9/8, 2021 at 22:42 Comment(0)
A
1

In GCC-9.0.0,Messages are now prefixed with optimizaed,missed,or note,rather than the old behavior of all being preixed with note. If want to get exhaustive log of all decisions made by the vectorizer via new -internals suboption of -fopt-info.

Anastasiaanastasie answered 7/11, 2020 at 7:10 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.