llvm-project/mlir/test/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
..
crash-recovery.mlir Fix crash in the pass pipeline when local reproducer is enabled 2020-09-21 08:52:50 +00:00
dynamic-pipeline-fail-on-parent.mlir [MLIR] Extend Symbol verification to reject public symbol declarations. 2020-11-16 16:05:32 -08:00
dynamic-pipeline-nested.mlir [mlir][Inliner] Refactor the inliner to use nested pass pipelines instead of just canonicalization 2020-12-14 18:09:47 -08:00
dynamic-pipeline.mlir Implement a new kind of Pass: dynamic pass pipeline 2020-09-22 18:51:54 +00:00
invalid-pass.mlir [mlir] Add error message when failing to add pass 2020-12-29 14:20:19 -08:00
ir-printing.mlir [mlir] Add a new context flag for disabling/enabling multi-threading 2020-05-02 12:32:25 -07:00
pass-timing.mlir Handle the verifier at run() time in the PassManager instead of build time 2020-11-03 11:17:14 +00:00
pipeline-options-parsing.mlir Disable implicit nesting on parsing textual pass pipeline 2020-11-11 19:21:51 +00:00
pipeline-parsing.mlir Disable implicit nesting on parsing textual pass pipeline 2020-11-11 19:21:51 +00:00
pipeline-stats.mlir [ADT] Remove StatisticBase and make NoopStatistic empty 2021-04-26 16:47:32 -07:00
run-reproducer.mlir Avoid using /dev/null in test 2020-12-30 14:16:13 -08:00