mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Address review comments
This commit is contained in:
parent
de7c836607
commit
03d38d42b7
@ -101,7 +101,7 @@ pub enum MirPhase {
|
|||||||
/// After this phase, generators are explicit state machines (no more `Yield`).
|
/// After this phase, generators are explicit state machines (no more `Yield`).
|
||||||
/// `AggregateKind::Generator` is gone for good.
|
/// `AggregateKind::Generator` is gone for good.
|
||||||
GeneratorLowering = 4,
|
GeneratorLowering = 4,
|
||||||
Optimized = 5,
|
Optimization = 5,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MirPhase {
|
impl MirPhase {
|
||||||
|
@ -436,7 +436,7 @@ impl<'mir, 'tcx: 'mir, M: super::intern::CompileTimeMachine<'mir, 'tcx>> InterpC
|
|||||||
/// A helper function that allocates memory for the layout given and gives you access to mutate
|
/// A helper function that allocates memory for the layout given and gives you access to mutate
|
||||||
/// it. Once your own mutation code is done, the backing `Allocation` is removed from the
|
/// it. Once your own mutation code is done, the backing `Allocation` is removed from the
|
||||||
/// current `Memory` and returned.
|
/// current `Memory` and returned.
|
||||||
pub(crate) fn with_temp_alloc(
|
pub(crate) fn intern_with_temp_alloc(
|
||||||
&mut self,
|
&mut self,
|
||||||
layout: TyAndLayout<'tcx>,
|
layout: TyAndLayout<'tcx>,
|
||||||
f: impl FnOnce(
|
f: impl FnOnce(
|
||||||
|
@ -845,7 +845,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
|
|||||||
if ty_is_scalar(ty1) && ty_is_scalar(ty2) {
|
if ty_is_scalar(ty1) && ty_is_scalar(ty2) {
|
||||||
let alloc = this
|
let alloc = this
|
||||||
.ecx
|
.ecx
|
||||||
.with_temp_alloc(value.layout, |ecx, dest| {
|
.intern_with_temp_alloc(value.layout, |ecx, dest| {
|
||||||
ecx.write_immediate_to_mplace(*imm, dest)
|
ecx.write_immediate_to_mplace(*imm, dest)
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -228,7 +228,7 @@ pub fn run_passes(
|
|||||||
|
|
||||||
body.phase = mir_phase;
|
body.phase = mir_phase;
|
||||||
|
|
||||||
if mir_phase == MirPhase::Optimized {
|
if mir_phase == MirPhase::Optimization {
|
||||||
validate::Validator { when: format!("end of phase {:?}", mir_phase), mir_phase }
|
validate::Validator { when: format!("end of phase {:?}", mir_phase), mir_phase }
|
||||||
.run_pass(tcx, source, body);
|
.run_pass(tcx, source, body);
|
||||||
}
|
}
|
||||||
@ -504,7 +504,7 @@ fn run_optimization_passes<'tcx>(
|
|||||||
body,
|
body,
|
||||||
InstanceDef::Item(ty::WithOptConstParam::unknown(def_id.to_def_id())),
|
InstanceDef::Item(ty::WithOptConstParam::unknown(def_id.to_def_id())),
|
||||||
promoted,
|
promoted,
|
||||||
MirPhase::Optimized,
|
MirPhase::Optimization,
|
||||||
&[
|
&[
|
||||||
if mir_opt_level > 0 { optimizations } else { no_optimizations },
|
if mir_opt_level > 0 { optimizations } else { no_optimizations },
|
||||||
pre_codegen_cleanup,
|
pre_codegen_cleanup,
|
||||||
|
Loading…
Reference in New Issue
Block a user