This is an archive of the discontinued LLVM Phabricator instance.

Add support for optimization reports.
ClosedPublic

Authored by dnovillo on Mar 31 2014, 9:28 AM.

Details

Reviewers
qcolombet
rsmith
Summary

This patch adds backend support for -Rpass=, which indicates the name
of the optimization pass that should emit remarks stating when it
made a transformation to the code.

Pass names are taken from their DEBUG_NAME definitions.

This is the back end counterpart for

http://llvm-reviews.chandlerc.com/D3226

Diff Detail

Event Timeline

dnovillo updated this revision to Unknown Object (????).Mar 31 2014, 2:52 PM
  • Tolerate lack of debug information.

When emitting an optimization report diagnostic, the lack of debug
information sometimes causes internal failures. If debug information
is not present, the diagnostic uses "<unknown>:0:0" as the location
string.

Hi Diego,

We are missing a test case here + a few minor things to check/fix.

Thanks,
-Quentin

include/llvm/Transforms/IPO/PassManagerBuilder.h
19 ↗(On Diff #8245)

Was this intended?
I do not see any other changes that require that.

lib/Transforms/IPO/Inliner.cpp
530

I’m not sure the lifetime of all the references you are using in Twine are long enough.

Could you double check that the things are not freed before you are using it (like the fix we had to do in r203996)?

dnovillo updated this revision to Unknown Object (????).Apr 2 2014, 6:59 PM

Address review feedback

  • When emitting an optimization report diagnostic, the lack of debug information sometimes causes internal failures. If debug information is not present, the diagnostic uses "<unknown>:0:0" as the location string.
  • Add LLVMContext::emitOptimizationRemark to simplify client's code.
  • Rename OptimizationReport to OptimizationRemark.
  • Add DiagnosticInfoOptimizationRemark::getLocation(). This returns the source file name, line and column number from the remark's location information. Used by DiagnosticInfoOptimizationRemark::getLocationStr()
dnovillo updated this revision to Unknown Object (????).Apr 3 2014, 8:46 AM
  • Fix typo. Recover unrelated change.
qcolombet accepted this revision.Apr 4 2014, 11:01 AM

Hi Diego,

LGTM.

Thanks,
-Quentin

dnovillo closed this revision.Apr 11 2014, 3:06 PM