You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`dump_mir_for_pass` and `dump_mir_for_phase_change` do some allocations
even when `-Zdump-mir` isn't used, and the cost is enough to be
noticeable.
This commit rearranges things to avoid the cost.
- `dump_mir` now dumps MIR unconditionally.
- The new `maybe_dump_mir` functions dumps MIR if `-Zdump-mir` is set
appropriately.
- `dump_enabled` is replaced with `pass_name_matches_dump_filters`,
which just does the second part of the test.
- Most places use `maybe_dump_mir`, but `dump_mir_for_pass` and
`dump_mir_for_phase_change` do their own tests to avoid the
allocations in the common cases where no MIR dumping occurs.
This is not the most elegant code ever written, but hopefully it's good
enough. I also tried using closures for `pass_num` and `pass_name` but
that ended up being uglier than this approach.
0 commit comments