OSDN Git Service

New tool: opt-stats.py
authorAdam Nemet <anemet@apple.com>
Wed, 1 Mar 2017 21:35:00 +0000 (21:35 +0000)
committerAdam Nemet <anemet@apple.com>
Wed, 1 Mar 2017 21:35:00 +0000 (21:35 +0000)
commitaa64e902ddfdada1bb33037c4c6b1425b28cba7b
treeb72c067c4c5869162763d52dc54f12322462ace6
parent22bd547eb3ab36c49274edfd25acf703ba452e47
New tool: opt-stats.py

I am planning to use this tool to find too noisy (missed) optimization
remarks.  Long term it may actually be better to just have another tool that
exports the remarks into an sqlite database and perform queries like this in
SQL.

This splits out the YAML parsing from opt-viewer.py into a new Python module
optrecord.py.

This is the result of the script on the LLVM testsuite:

Total number of remarks        714433

Top 10 remarks by pass:
  inline                         52%
  gvn                            24%
  licm                           13%
  loop-vectorize                  5%
  asm-printer                     3%
  loop-unroll                     1%
  regalloc                        1%
  inline-cost                     0%
  slp-vectorizer                  0%
  loop-delete                     0%

Top 10 remarks:
  gvn/LoadClobbered              20%
  inline/Inlined                 19%
  inline/CanBeInlined            18%
  inline/NoDefinition             9%
  licm/LoadWithLoopInvariantAddressInvalidated  6%
  licm/Hoisted                    6%
  asm-printer/InstructionCount    3%
  inline/TooCostly                3%
  gvn/LoadElim                    3%
  loop-vectorize/MissedDetails    2%

Beside some refactoring, I also changed optrecords not to use context to
access global data (max_hotness).  Because of the separate module this would
have required splitting context into two.  However it's not possible to access
the optrecord context from the SourceFileRenderer when calling back to
Remark.RelativeHotness.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296682 91177308-0d34-0410-b5e6-96231b3b80d8
utils/opt-viewer/opt-stats.py [new file with mode: 0755]
utils/opt-viewer/opt-viewer.py
utils/opt-viewer/optrecord.py [new file with mode: 0644]