llvm-project/mlir/lib/Pass
Fangrui Song 18839be9c5 [ADT] Remove StatisticBase and make NoopStatistic empty
In LLVM_ENABLE_STATS=0 builds, `llvm::Statistic` maps to `llvm::NoopStatistic`
but has 3 mostly unused pointers. GlobalOpt considers that the pointers can
potentially retain allocated objects, so GlobalOpt cannot optimize out the
`NoopStatistic` variables (see D69428 for more context), wasting 23KiB for stage
2 clang.

This patch makes `NoopStatistic` empty and thus reclaims the wasted space.  The
clang size is even smaller than applying D69428 (slightly smaller in both .bss and
.text).
```
# This means the D69428 optimization on clang is mostly nullified by this patch.
HEAD+D69428: size(.bss) = 0x0725a8
HEAD+D101211: size(.bss) = 0x072238

# bloaty - HEAD+D69428 vs HEAD+D101211
# With D101211, we also save a lot of string table space (.rodata).
    FILE SIZE        VM SIZE
 --------------  --------------
  -0.0%     -32  -0.0%     -24    .eh_frame
  -0.0%    -336  [ = ]       0    .symtab
  -0.0%    -360  [ = ]       0    .strtab
  [ = ]       0  -0.2%    -880    .bss
  -0.0% -2.11Ki  -0.0% -2.11Ki    .rodata
  -0.0% -2.89Ki  -0.0% -2.89Ki    .text
  -0.0% -5.71Ki  -0.0% -5.88Ki    TOTAL
```

Note: LoopFuse is a disabled pass. For now this patch adds
`#if LLVM_ENABLE_STATS` so `OptimizationRemarkMissed` is skipped in
LLVM_ENABLE_STATS==0 builds.  If these `OptimizationRemarkMissed` are useful in
LLVM_ENABLE_STATS==0 builds, we can replace `llvm::Statistic` with
`llvm::TrackingStatistic`, or use a different abstraction to keep track of the strings.

Similarly, skip the code in `mlir/lib/Pass/PassStatistics.cpp` which
calls `getName`/`getDesc`/`getValue`.

Reviewed By: lattner

Differential Revision: https://reviews.llvm.org/D101211
2021-04-26 16:47:32 -07:00
..
CMakeLists.txt [MLIR][cmake] don't glob for sources. 2020-05-13 23:21:01 -07:00
IRPrinting.cpp [mlir] Remove the MutableDictionaryAttr class 2020-12-17 17:18:42 -08:00
Pass.cpp [mlir] Tune error message for assertion. 2021-03-22 18:10:18 -07:00
PassDetail.h [mlir] Add a hook for initializing passes before execution and use it in the Canonicalizer 2021-01-08 13:36:12 -08:00
PassManagerOptions.cpp [mlir][Pass] Add a new PassNameCLParser specifically for parsing lists of pass names 2020-12-15 14:56:09 -08:00
PassRegistry.cpp [mlir] hopefully final round of iwyu fixes after ba7a92c01e 2021-04-21 11:03:06 -04:00
PassStatistics.cpp [ADT] Remove StatisticBase and make NoopStatistic empty 2021-04-26 16:47:32 -07:00
PassTiming.cpp [mlir][Inliner] Refactor the inliner to use nested pass pipelines instead of just canonicalization 2020-12-14 18:09:47 -08:00