about summary refs log tree commit diff
path: root/src/libsyntax/errors
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-04-28 01:26:45 -0700
committerbors <bors@rust-lang.org>2016-04-28 01:26:45 -0700
commit009a64916e7f51df7e4e4e1df603eb4be1c7a6d8 (patch)
tree6acdf574529f5f4027fab5c3c097cd69bf360058 /src/libsyntax/errors
parentcf3970aac536ea446a967a246cc3527a11d89655 (diff)
parent5bda576cd6b3be40f62a37e134ee7245e911fb8b (diff)
downloadrust-009a64916e7f51df7e4e4e1df603eb4be1c7a6d8.tar.gz
rust-009a64916e7f51df7e4e4e1df603eb4be1c7a6d8.zip
Auto merge of #32980 - Aatch:better-mir-building, r=nagisa
Various improvements to MIR and LLVM IR Construction

Primarily affects the MIR construction, which indirectly improves LLVM
IR generation, but some LLVM IR changes have been made too.

* Handle "statement expressions" more intelligently. These are
  expressions that always evaluate to `()`. Previously a temporary would
  be generated as a destination to translate into, which is unnecessary.

  This affects assignment, augmented assignment, `return`, `break` and
  `continue`.
* Avoid inserting drops for non-drop types in more places. Scheduled
  drops were already skipped for types that we knew wouldn't need
  dropping at construction time. However manually-inserted drops like
  those for `x` in `x = y;` were still generated. `build_drop` now takes
  a type parameter like its `schedule_drop` counterpart and checks to
  see if the type needs dropping.

* Avoid generating an extra temporary for an assignment where the types
  involved don't need dropping. Previously an expression like
  `a = b + 1;` would result in a temporary for `b + 1`. This is so the
  RHS can be evaluated, then the LHS evaluated and dropped and have
  everything work correctly. However, this isn't necessary if the `LHS`
  doesn't need a drop, as we can just overwrite the existing value.

* Improves lvalue analysis to allow treating an `Rvalue::Use` as an
  operand in certain conditions. The reason for it never being an
  operand is so it can be zeroed/drop-filled, but this is only true for
  types that need dropping.

The first two changes result in significantly fewer MIR blocks being
generated, as previously almost every statement would end up generating
a new block due to the drop of the `()` temporary being generated.
Diffstat (limited to 'src/libsyntax/errors')
0 files changed, 0 insertions, 0 deletions