Skip to content

Commit dff3156

Browse files
committed
rustc_mir: always run the deaggregator.
1 parent 8e30a60 commit dff3156

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

src/librustc_mir/transform/deaggregator.rs

-5
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@ impl MirPass for Deaggregator {
3939
}
4040
}
4141

42-
// We only run when the MIR optimization level is > 2.
43-
if tcx.sess.opts.debugging_opts.mir_opt_level <= 2 {
44-
return;
45-
}
46-
4742
let can_deaggregate = |statement: &Statement| {
4843
if let StatementKind::Assign(_, ref rhs) = statement.kind {
4944
if let Rvalue::Aggregate(..) = *rhs {

src/librustc_mir/transform/mod.rs

+5
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,11 @@ fn optimized_mir<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx
255255

256256
// Optimizations begin.
257257
inline::Inline,
258+
259+
// Lowering generator control-flow and variables
260+
// has to happen before we do anything else to them.
261+
generator::StateTransform,
262+
258263
instcombine::InstCombine,
259264
deaggregator::Deaggregator,
260265
copy_prop::CopyPropagation,

src/test/codegen/lifetime_start_end.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ pub fn test() {
2828
// CHECK: [[S_b:%[0-9]+]] = bitcast %"core::option::Option<i32>"** %b to i8*
2929
// CHECK: call void @llvm.lifetime.start{{.*}}(i{{[0-9 ]+}}, i8* [[S_b]])
3030

31-
// CHECK: [[S__5:%[0-9]+]] = bitcast %"core::option::Option<i32>"* %_5 to i8*
32-
// CHECK: call void @llvm.lifetime.start{{.*}}(i{{[0-9 ]+}}, i8* [[S__5]])
31+
// CHECK: [[S__4:%[0-9]+]] = bitcast %"core::option::Option<i32>"* %_4 to i8*
32+
// CHECK: call void @llvm.lifetime.start{{.*}}(i{{[0-9 ]+}}, i8* [[S__4]])
3333

3434
// CHECK: [[E_b:%[0-9]+]] = bitcast %"core::option::Option<i32>"** %b to i8*
3535
// CHECK: call void @llvm.lifetime.end{{.*}}(i{{[0-9 ]+}}, i8* [[E_b]])
3636

37-
// CHECK: [[E__5:%[0-9]+]] = bitcast %"core::option::Option<i32>"* %_5 to i8*
38-
// CHECK: call void @llvm.lifetime.end{{.*}}(i{{[0-9 ]+}}, i8* [[E__5]])
37+
// CHECK: [[E__4:%[0-9]+]] = bitcast %"core::option::Option<i32>"* %_4 to i8*
38+
// CHECK: call void @llvm.lifetime.end{{.*}}(i{{[0-9 ]+}}, i8* [[E__4]])
3939
}
4040

4141
let c = 1;

src/test/codegen/match.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub enum E {
1919

2020
// CHECK-LABEL: @exhaustive_match
2121
#[no_mangle]
22-
pub fn exhaustive_match(e: E) {
22+
pub fn exhaustive_match(e: E, unit: ()) {
2323
// CHECK: switch{{.*}}, label %[[OTHERWISE:[a-zA-Z0-9_]+]] [
2424
// CHECK-NEXT: i[[TY:[0-9]+]] [[DISCR:[0-9]+]], label %[[A:[a-zA-Z0-9_]+]]
2525
// CHECK-NEXT: i[[TY:[0-9]+]] [[DISCR:[0-9]+]], label %[[B:[a-zA-Z0-9_]+]]
@@ -31,7 +31,7 @@ pub fn exhaustive_match(e: E) {
3131
// CHECK: [[OTHERWISE]]:
3232
// CHECK-NEXT: unreachable
3333
match e {
34-
E::A => (),
35-
E::B => (),
34+
E::A => unit,
35+
E::B => unit,
3636
}
3737
}

src/test/incremental/hashes/closure_expressions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub fn change_parameter_pattern() {
6464
}
6565

6666
#[cfg(not(cfail1))]
67-
#[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, MirOptimized, TypeckTables")]
67+
#[rustc_clean(cfg="cfail2", except="HirBody, MirValidated, TypeckTables")]
6868
#[rustc_clean(cfg="cfail3")]
6969
pub fn change_parameter_pattern() {
7070
let _ = |&x: &u32| x;

src/test/incremental/issue-38222.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#![feature(rustc_attrs)]
1919

2020

21-
#![rustc_partition_translated(module="issue_38222-mod1", cfg="rpass2")]
21+
#![rustc_partition_reused(module="issue_38222-mod1", cfg="rpass2")]
2222

2323
// If trans had added a dependency edge to the Krate dep-node, nothing would
2424
// be re-used, so checking that this module was re-used is sufficient.

src/test/ui/print_type_sizes/generics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ pub fn f1<T:Copy>(x: T) {
7272
fn start(_: isize, _: *const *const u8) -> isize {
7373
let _b: Pair<u8> = Pair::new(0, 0);
7474
let _s: Pair<SevenBytes> = Pair::new(SevenBytes::new(), SevenBytes::new());
75-
let _z: ZeroSized = ZeroSized;
75+
let ref _z: ZeroSized = ZeroSized;
7676
f1::<SevenBytes>(SevenBytes::new());
7777
0
7878
}

0 commit comments

Comments
 (0)