RFC - Adding an optimization report facility?

Hi Diego, I really like your suggestion and agree that this could be really useful to end users looking to understand why the compiler was unable to apply certain optimisations to the code.

Often, understanding why the compiler failed to auto-vectorise is incredibly useful information allowing the end user to write the code in a more amenable form, to allow the compiler to do a better job.

We often use the -ftree-vectorizer-verbose= options in gcc to understand both which loops were vectorized and which weren’t for what reason, it is much more convenient than reading the generated assembly file :slight_smile:

I’d like to reiterate Gerolf’s comment that different levels of verbosity would be really useful, personally I’d like to see all the way down to very detailed analysis of the decisions the compiler is taking if you set the verbosity level high enough, like -vec-report an -ftree-vectorizer-verbose in other compilers.

This is something we’d be really interested in seeing added and we had already started working on something similar ourselves, though it obviously makes more sense for us to contribute to this effort.

What is the current status of the implementation?

Neil

I'd like to reiterate Gerolf's comment that different levels of verbosity

would be really useful, personally I'd like to see all the way down to very
detailed analysis of the decisions the compiler is taking if you set the
verbosity level high enough, like -vec-report an -ftree-vectorizer-verbose
in other compilers.

Yeah. The vectorizer is one of the most useful to instrument.

This is something we'd be really interested in seeing added and we had
already started working on something similar ourselves, though it obviously
makes more sense for us to contribute to this effort.

Thanks!

What is the current status of the implementation?

It's under review. http://llvm-reviews.chandlerc.com/D3226 and
http://llvm-reviews.chandlerc.com/D3227.

So far, I've only instrumented the inliner. My immediate plans are to add
instrumentation to the major ones: loop, vector and inliner. Adding
diagnostics to other optimizers is ~trivial once the main patches land. I
need to address the current feedback, add tests and finish the review
cycle. I suppose it will take a few more days.

Thanks. Diego.