about summary refs log tree commit diff
path: root/src/test/run-pass/thinlto
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2016-11-30 18:14:17 +0100
committerFelix S. Klock II <pnkfelix@pnkfx.org>2016-11-30 21:33:18 +0100
commitff1ba6a5052a3d995c31a2266e0b9cd6b1d44c1e (patch)
treeb232b0491bc68c92d26bcf44d4acb43421f172bd /src/test/run-pass/thinlto
parent5a0248068c693c64f74623e9a6f7504b900df8a6 (diff)
downloadrust-ff1ba6a5052a3d995c31a2266e0b9cd6b1d44c1e.tar.gz
rust-ff1ba6a5052a3d995c31a2266e0b9cd6b1d44c1e.zip
Adds `-Z mir-stats`, which is similar to `-Z hir-stats`.
Some notes:

* This code attempts to present the breakdown of each variant for
  every enum in the MIR. This is meant to guide decisions about how to
  revise representations e.g. when to box payloads for rare variants
  to shrink the size of the enum overall.

* I left out the "Total:" line that hir-stats presents, because this
  implementation uses the MIR Visitor infrastructure, and the memory
  usage of structures directly embedded in other structures (e.g. the
  `func: Operand` in a `TerminatorKind:Call`) is not distinguished
  from similar structures allocated in a `Vec` (e.g. the `args:
  Vec<Operand>` in a `TerminatorKind::Call`). This means that a naive
  summation of all the accumulated sizes is misleading, because it
  will double-count the contribution of the `Operand` of the `func` as
  well as the size of the whole `TerminatorKind`.

  * I did consider abandoning the MIR Visitor and instead hand-coding
    a traversal that distinguished embedded storage from indirect
    storage. But such code would be fragile; better to just require
    people to take care when interpreting the presented results.

* This traverses the `mir.promoted` rvalues to capture stats for MIR
  stored there, even though the MIR visitor super_mir method does not
  do so. (I did not observe any new mir being traversed when compiling
  the rustc crate, however.)

* It might be nice to try to unify this code with hir-stats.  Then
  again, the reporting portion is the only common code (I think), and
  it is small compared to the visitors in hir-stats and mir-stats.
Diffstat (limited to 'src/test/run-pass/thinlto')
0 files changed, 0 insertions, 0 deletions