about summary refs log tree commit diff
path: root/src/test
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/test
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/test')
-rw-r--r--src/test/codegen-units/item-collection/impl-in-non-instantiated-generic.rs2
-rw-r--r--src/test/codegen-units/item-collection/non-generic-closures.rs2
-rw-r--r--src/test/codegen-units/partitioning/inlining-from-extern-crate.rs2
-rw-r--r--src/test/codegen-units/partitioning/local-inlining.rs2
-rw-r--r--src/test/codegen-units/partitioning/local-transitive-inlining.rs2
5 files changed, 0 insertions, 10 deletions
diff --git a/src/test/codegen-units/item-collection/impl-in-non-instantiated-generic.rs b/src/test/codegen-units/item-collection/impl-in-non-instantiated-generic.rs
index a3bfa67e1ae..c43c254f339 100644
--- a/src/test/codegen-units/item-collection/impl-in-non-instantiated-generic.rs
+++ b/src/test/codegen-units/item-collection/impl-in-non-instantiated-generic.rs
@@ -32,5 +32,3 @@ pub fn generic_function<T>(x: T) -> (T, i32) {
 fn main() {
     0i64.foo();
 }
-
-//~ TRANS_ITEM drop-glue i8
diff --git a/src/test/codegen-units/item-collection/non-generic-closures.rs b/src/test/codegen-units/item-collection/non-generic-closures.rs
index bf8804e12ce..ba77266d072 100644
--- a/src/test/codegen-units/item-collection/non-generic-closures.rs
+++ b/src/test/codegen-units/item-collection/non-generic-closures.rs
@@ -59,5 +59,3 @@ fn main() {
 fn run_closure(f: &Fn(i32)) {
     f(3);
 }
-
-//~ TRANS_ITEM drop-glue i8
diff --git a/src/test/codegen-units/partitioning/inlining-from-extern-crate.rs b/src/test/codegen-units/partitioning/inlining-from-extern-crate.rs
index f4732a7bcf8..469f2c08c39 100644
--- a/src/test/codegen-units/partitioning/inlining-from-extern-crate.rs
+++ b/src/test/codegen-units/partitioning/inlining-from-extern-crate.rs
@@ -57,5 +57,3 @@ mod mod2 {
         cgu_explicit_inlining::never_inlined();
     }
 }
-
-//~ TRANS_ITEM drop-glue i8
diff --git a/src/test/codegen-units/partitioning/local-inlining.rs b/src/test/codegen-units/partitioning/local-inlining.rs
index dfd8f725b61..d2bfa838346 100644
--- a/src/test/codegen-units/partitioning/local-inlining.rs
+++ b/src/test/codegen-units/partitioning/local-inlining.rs
@@ -50,5 +50,3 @@ mod non_user {
 
     }
 }
-
-//~ TRANS_ITEM drop-glue i8
diff --git a/src/test/codegen-units/partitioning/local-transitive-inlining.rs b/src/test/codegen-units/partitioning/local-transitive-inlining.rs
index ea3a1cd34be..2e47dc5c902 100644
--- a/src/test/codegen-units/partitioning/local-transitive-inlining.rs
+++ b/src/test/codegen-units/partitioning/local-transitive-inlining.rs
@@ -50,5 +50,3 @@ mod non_user {
 
     }
 }
-
-//~ TRANS_ITEM drop-glue i8