OSDN Git Service

Add remarks describing when a pass changes the IR instruction count of a module
authorJessica Paquette <jpaquette@apple.com>
Fri, 18 May 2018 17:26:39 +0000 (17:26 +0000)
committerJessica Paquette <jpaquette@apple.com>
Fri, 18 May 2018 17:26:39 +0000 (17:26 +0000)
commit849da555d2214bed1645f02fc5cde199c7e69bde
tree32a12212946893a4bff1d7d59a5b854dde6d11b4
parent1c0183accbe8cea0fcb9aa1ca9ac6b854fac36ba
Add remarks describing when a pass changes the IR instruction count of a module

This patch adds a remark which tells the user when a pass changes the number of
IR instructions in a module.

It can be enabled by using -Rpass-analysis=size-info.

The point of this is to make it easier to collect statistics on how passes
modify programs in terms of code size. This is similar in concept to timing
reports, but using a remark-based interface makes it easy to diff changes over
multiple compilations of the same program.

By adding functionality like this, we can see
  * Which passes impact code size the most
  * How passes impact code size at different optimization levels
  * Which pass might have contributed the most to an overall code size
    regression

The patch lives in the legacy pass manager, but since it's simply emitting
remarks, it shouldn't be too difficult to adapt the functionality to the new
pass manager as well. This can also be adapted to handle MachineInstr counts in
code gen passes.

https://reviews.llvm.org/D38768

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332739 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/Function.h
include/llvm/IR/LegacyPassManagers.h
include/llvm/IR/Module.h
lib/Analysis/CallGraphSCCPass.cpp
lib/Analysis/LoopPass.cpp
lib/IR/Function.cpp
lib/IR/LegacyPassManager.cpp
lib/IR/Module.cpp
test/Other/size-remarks.ll [new file with mode: 0644]