mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Do not normalize constants eagerly.
This commit is contained in:
parent
249cf71f11
commit
a0b4d6dfb8
@ -773,10 +773,7 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
|
||||
location: Location,
|
||||
) -> Option<VnIndex> {
|
||||
match *operand {
|
||||
Operand::Constant(ref mut constant) => {
|
||||
let const_ = constant.const_.normalize(self.tcx, self.param_env);
|
||||
self.insert_constant(const_)
|
||||
}
|
||||
Operand::Constant(ref constant) => self.insert_constant(constant.const_),
|
||||
Operand::Copy(ref mut place) | Operand::Move(ref mut place) => {
|
||||
let value = self.simplify_place_value(place, location)?;
|
||||
if let Some(const_) = self.try_as_constant(value) {
|
||||
|
@ -103,9 +103,9 @@ pub fn change_iterable() {
|
||||
}
|
||||
|
||||
#[cfg(not(any(cfail1,cfail4)))]
|
||||
#[rustc_clean(cfg="cfail2", except="opt_hir_owner_nodes, promoted_mir, optimized_mir")]
|
||||
#[rustc_clean(cfg="cfail2", except="opt_hir_owner_nodes, promoted_mir")]
|
||||
#[rustc_clean(cfg="cfail3")]
|
||||
#[rustc_clean(cfg="cfail5", except="opt_hir_owner_nodes, promoted_mir, optimized_mir")]
|
||||
#[rustc_clean(cfg="cfail5", except="opt_hir_owner_nodes, promoted_mir")]
|
||||
#[rustc_clean(cfg="cfail6")]
|
||||
pub fn change_iterable() {
|
||||
let mut _x = 0;
|
||||
|
@ -22,12 +22,11 @@
|
||||
StorageLive(_3);
|
||||
StorageLive(_4);
|
||||
_9 = const main::promoted[0];
|
||||
- _4 = _9;
|
||||
_4 = _9;
|
||||
- _3 = _4;
|
||||
- _2 = move _3 as &[u32] (PointerCoercion(Unsize));
|
||||
+ _4 = const {ALLOC0<imm>: &[u32; 3]};
|
||||
+ _3 = const {ALLOC0<imm>: &[u32; 3]};
|
||||
+ _2 = const {ALLOC0<imm>: &[u32; 3]} as &[u32] (PointerCoercion(Unsize));
|
||||
+ _3 = _9;
|
||||
+ _2 = _9 as &[u32] (PointerCoercion(Unsize));
|
||||
StorageDead(_3);
|
||||
StorageLive(_6);
|
||||
_6 = const 1_usize;
|
||||
@ -50,6 +49,4 @@
|
||||
return;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ ALLOC0 (size: 12, align: 4) { .. }
|
||||
|
||||
|
@ -22,12 +22,11 @@
|
||||
StorageLive(_3);
|
||||
StorageLive(_4);
|
||||
_9 = const main::promoted[0];
|
||||
- _4 = _9;
|
||||
_4 = _9;
|
||||
- _3 = _4;
|
||||
- _2 = move _3 as &[u32] (PointerCoercion(Unsize));
|
||||
+ _4 = const {ALLOC0<imm>: &[u32; 3]};
|
||||
+ _3 = const {ALLOC0<imm>: &[u32; 3]};
|
||||
+ _2 = const {ALLOC0<imm>: &[u32; 3]} as &[u32] (PointerCoercion(Unsize));
|
||||
+ _3 = _9;
|
||||
+ _2 = _9 as &[u32] (PointerCoercion(Unsize));
|
||||
StorageDead(_3);
|
||||
StorageLive(_6);
|
||||
_6 = const 1_usize;
|
||||
@ -50,6 +49,4 @@
|
||||
return;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ ALLOC0 (size: 12, align: 4) { .. }
|
||||
|
||||
|
@ -22,12 +22,11 @@
|
||||
StorageLive(_3);
|
||||
StorageLive(_4);
|
||||
_9 = const main::promoted[0];
|
||||
- _4 = _9;
|
||||
_4 = _9;
|
||||
- _3 = _4;
|
||||
- _2 = move _3 as &[u32] (PointerCoercion(Unsize));
|
||||
+ _4 = const {ALLOC0<imm>: &[u32; 3]};
|
||||
+ _3 = const {ALLOC0<imm>: &[u32; 3]};
|
||||
+ _2 = const {ALLOC0<imm>: &[u32; 3]} as &[u32] (PointerCoercion(Unsize));
|
||||
+ _3 = _9;
|
||||
+ _2 = _9 as &[u32] (PointerCoercion(Unsize));
|
||||
StorageDead(_3);
|
||||
StorageLive(_6);
|
||||
_6 = const 1_usize;
|
||||
@ -50,6 +49,4 @@
|
||||
return;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ ALLOC0 (size: 12, align: 4) { .. }
|
||||
|
||||
|
@ -22,12 +22,11 @@
|
||||
StorageLive(_3);
|
||||
StorageLive(_4);
|
||||
_9 = const main::promoted[0];
|
||||
- _4 = _9;
|
||||
_4 = _9;
|
||||
- _3 = _4;
|
||||
- _2 = move _3 as &[u32] (PointerCoercion(Unsize));
|
||||
+ _4 = const {ALLOC0<imm>: &[u32; 3]};
|
||||
+ _3 = const {ALLOC0<imm>: &[u32; 3]};
|
||||
+ _2 = const {ALLOC0<imm>: &[u32; 3]} as &[u32] (PointerCoercion(Unsize));
|
||||
+ _3 = _9;
|
||||
+ _2 = _9 as &[u32] (PointerCoercion(Unsize));
|
||||
StorageDead(_3);
|
||||
StorageLive(_6);
|
||||
_6 = const 1_usize;
|
||||
@ -50,6 +49,4 @@
|
||||
return;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ ALLOC0 (size: 12, align: 4) { .. }
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
fn main() {
|
||||
// CHECK-LABEL: fn main(
|
||||
// CHECK: debug a => [[a:_.*]];
|
||||
// CHECK: [[slice:_.*]] = const {{.*}} as &[u32] (PointerCoercion(Unsize));
|
||||
// CHECK: [[slice:_.*]] = {{.*}} as &[u32] (PointerCoercion(Unsize));
|
||||
// CHECK: assert(const true,
|
||||
// CHECK: [[a]] = const 2_u32;
|
||||
let a = (&[1u32, 2, 3] as &[u32])[1];
|
||||
|
@ -73,13 +73,12 @@
|
||||
StorageLive(_6);
|
||||
StorageLive(_7);
|
||||
_9 = const main::promoted[0];
|
||||
- _7 = _9;
|
||||
+ _7 = const {ALLOC1<imm>: &std::alloc::Global};
|
||||
_7 = _9;
|
||||
StorageLive(_8);
|
||||
- _8 = _1;
|
||||
- _6 = std::alloc::Global::alloc_impl(move _7, move _8, const false) -> [return: bb4, unwind unreachable];
|
||||
+ _8 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum) }};
|
||||
+ _6 = std::alloc::Global::alloc_impl(const {ALLOC1<imm>: &std::alloc::Global}, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum) }}, const false) -> [return: bb4, unwind unreachable];
|
||||
+ _6 = std::alloc::Global::alloc_impl(_9, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum) }}, const false) -> [return: bb4, unwind unreachable];
|
||||
}
|
||||
|
||||
bb4: {
|
||||
@ -119,11 +118,9 @@
|
||||
+ nop;
|
||||
return;
|
||||
}
|
||||
}
|
||||
+ }
|
||||
+
|
||||
+ ALLOC0 (size: 8, align: 4) {
|
||||
+ 00 00 00 00 __ __ __ __ │ ....░░░░
|
||||
+ }
|
||||
+
|
||||
+ ALLOC1 (size: 0, align: 1) {}
|
||||
}
|
||||
|
||||
|
@ -81,13 +81,12 @@
|
||||
StorageLive(_6);
|
||||
StorageLive(_7);
|
||||
_9 = const main::promoted[0];
|
||||
- _7 = _9;
|
||||
+ _7 = const {ALLOC1<imm>: &std::alloc::Global};
|
||||
_7 = _9;
|
||||
StorageLive(_8);
|
||||
- _8 = _1;
|
||||
- _6 = std::alloc::Global::alloc_impl(move _7, move _8, const false) -> [return: bb5, unwind continue];
|
||||
+ _8 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum) }};
|
||||
+ _6 = std::alloc::Global::alloc_impl(const {ALLOC1<imm>: &std::alloc::Global}, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum) }}, const false) -> [return: bb5, unwind continue];
|
||||
+ _6 = std::alloc::Global::alloc_impl(_9, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x00000000): std::ptr::alignment::AlignmentEnum) }}, const false) -> [return: bb5, unwind continue];
|
||||
}
|
||||
|
||||
bb5: {
|
||||
@ -95,11 +94,9 @@
|
||||
StorageDead(_7);
|
||||
_5 = Result::<NonNull<[u8]>, std::alloc::AllocError>::unwrap(move _6) -> [return: bb1, unwind continue];
|
||||
}
|
||||
}
|
||||
+ }
|
||||
+
|
||||
+ ALLOC0 (size: 8, align: 4) {
|
||||
+ 00 00 00 00 __ __ __ __ │ ....░░░░
|
||||
+ }
|
||||
+
|
||||
+ ALLOC1 (size: 0, align: 1) {}
|
||||
}
|
||||
|
||||
|
@ -73,13 +73,12 @@
|
||||
StorageLive(_6);
|
||||
StorageLive(_7);
|
||||
_9 = const main::promoted[0];
|
||||
- _7 = _9;
|
||||
+ _7 = const {ALLOC1<imm>: &std::alloc::Global};
|
||||
_7 = _9;
|
||||
StorageLive(_8);
|
||||
- _8 = _1;
|
||||
- _6 = std::alloc::Global::alloc_impl(move _7, move _8, const false) -> [return: bb4, unwind unreachable];
|
||||
+ _8 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum) }};
|
||||
+ _6 = std::alloc::Global::alloc_impl(const {ALLOC1<imm>: &std::alloc::Global}, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum) }}, const false) -> [return: bb4, unwind unreachable];
|
||||
+ _6 = std::alloc::Global::alloc_impl(_9, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum) }}, const false) -> [return: bb4, unwind unreachable];
|
||||
}
|
||||
|
||||
bb4: {
|
||||
@ -119,11 +118,9 @@
|
||||
+ nop;
|
||||
return;
|
||||
}
|
||||
}
|
||||
+ }
|
||||
+
|
||||
+ ALLOC0 (size: 16, align: 8) {
|
||||
+ 00 00 00 00 00 00 00 00 __ __ __ __ __ __ __ __ │ ........░░░░░░░░
|
||||
+ }
|
||||
+
|
||||
+ ALLOC1 (size: 0, align: 1) {}
|
||||
}
|
||||
|
||||
|
@ -81,13 +81,12 @@
|
||||
StorageLive(_6);
|
||||
StorageLive(_7);
|
||||
_9 = const main::promoted[0];
|
||||
- _7 = _9;
|
||||
+ _7 = const {ALLOC1<imm>: &std::alloc::Global};
|
||||
_7 = _9;
|
||||
StorageLive(_8);
|
||||
- _8 = _1;
|
||||
- _6 = std::alloc::Global::alloc_impl(move _7, move _8, const false) -> [return: bb5, unwind continue];
|
||||
+ _8 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum) }};
|
||||
+ _6 = std::alloc::Global::alloc_impl(const {ALLOC1<imm>: &std::alloc::Global}, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum) }}, const false) -> [return: bb5, unwind continue];
|
||||
+ _6 = std::alloc::Global::alloc_impl(_9, const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(8 bytes) }: usize, align: std::ptr::Alignment(Scalar(0x0000000000000000): std::ptr::alignment::AlignmentEnum) }}, const false) -> [return: bb5, unwind continue];
|
||||
}
|
||||
|
||||
bb5: {
|
||||
@ -95,11 +94,9 @@
|
||||
StorageDead(_7);
|
||||
_5 = Result::<NonNull<[u8]>, std::alloc::AllocError>::unwrap(move _6) -> [return: bb1, unwind continue];
|
||||
}
|
||||
}
|
||||
+ }
|
||||
+
|
||||
+ ALLOC0 (size: 16, align: 8) {
|
||||
+ 00 00 00 00 00 00 00 00 __ __ __ __ __ __ __ __ │ ........░░░░░░░░
|
||||
+ }
|
||||
+
|
||||
+ ALLOC1 (size: 0, align: 1) {}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user