[PATCH] D21771: [OptRemark] RFC: Add hotness attribute

Adam Nemet via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 27 15:25:43 PDT 2016


anemet created this revision.
anemet added a reviewer: hfinkel.
anemet added a subscriber: llvm-commits.
Herald added a subscriber: mzolotukhin.

This is sort of a cross-sectional patch; rather than implementing the
hotness attribute for all optimization remark and all passes in a patch
set, it implements it for the 'missed-optimization' remark for one
specific case in the Loop Vectorizer.  My goal is to shake out the
design issues before scaling it up to other types and passes.

There is a layering challenge here.  We need to access BFI to compute
hotness and it would be convenient hide this in the DiagnosticInfo
layer.  However, BFI is in Analysis while DiagnosticInfo is in Core so
we can't trivially do this.

What I did was to add an alternative API for the low-level
emitOptimizationRemarkMissed in a new module
Analysis/OptimizationDiagnosticInfo.  This is where the hotness
attribute is computed from BFI and the DiagnosticInfo layer only sees
the compute attribute.

My plan is to switch all user of emitOptimizationRemark* to use this
module instead.

Hotness is computed as an integer as the multiplication of the block
frequency with the function entry count.  It's only printed in opt
currently since clang prints the diagnostic fields directly.

http://reviews.llvm.org/D21771

Files:
  include/llvm/Analysis/OptimizationDiagnosticInfo.h
  include/llvm/IR/DiagnosticInfo.h
  lib/Analysis/CMakeLists.txt
  lib/Analysis/OptimizationDiagnosticInfo.cpp
  lib/IR/DiagnosticInfo.cpp
  lib/Transforms/Vectorize/LoopVectorize.cpp
  test/Transforms/LoopVectorize/diag-with-hotness-info.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21771.62026.patch
Type: text/x-patch
Size: 19477 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160627/95689900/attachment.bin>


More information about the llvm-commits mailing list