diff options
| author | bors <bors@rust-lang.org> | 2023-01-26 03:10:52 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-01-26 03:10:52 +0000 |
| commit | 885bf628879310b885721e1fdd91ea2cbca9311f (patch) | |
| tree | eab86e1cccf55fb17843111cd9d66186de95db78 /compiler/rustc_const_eval/src/interpret | |
| parent | 2a17174ee639f8e0a3cee307d5685d38beb474ba (diff) | |
| parent | 5bfad5cc858d3b59d30da6d411449883581ff510 (diff) | |
| download | rust-885bf628879310b885721e1fdd91ea2cbca9311f.tar.gz rust-885bf628879310b885721e1fdd91ea2cbca9311f.zip | |
Auto merge of #105582 - saethlin:instcombine-assert-inhabited, r=cjgillot
InstCombine away intrinsic validity assertions This optimization (currently) fires 246 times on the standard library. It seems to fire hardly at all on the big crates in the benchmark suite. Interesting.
Diffstat (limited to 'compiler/rustc_const_eval/src/interpret')
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/intrinsics.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/intrinsics.rs b/compiler/rustc_const_eval/src/interpret/intrinsics.rs index cc7b6c91b60..f87e4fbc1a1 100644 --- a/compiler/rustc_const_eval/src/interpret/intrinsics.rs +++ b/compiler/rustc_const_eval/src/interpret/intrinsics.rs @@ -447,7 +447,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { } if intrinsic_name == sym::assert_zero_valid { - let should_panic = !self.tcx.permits_zero_init(layout); + let should_panic = !self.tcx.permits_zero_init(self.param_env.and(layout)); if should_panic { M::abort( @@ -461,7 +461,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { } if intrinsic_name == sym::assert_mem_uninitialized_valid { - let should_panic = !self.tcx.permits_uninit_init(layout); + let should_panic = !self.tcx.permits_uninit_init(self.param_env.and(layout)); if should_panic { M::abort( |
