InterpCx
store TypingEnv
instead of a ParamEnv
This commit is contained in:
parent
b9dea31ea9
commit
7a90e84f4d
36 changed files with 167 additions and 192 deletions
|
@ -149,7 +149,7 @@ impl<'a, 'tcx> ConstAnalysis<'a, 'tcx> {
|
|||
map,
|
||||
tcx,
|
||||
local_decls: &body.local_decls,
|
||||
ecx: InterpCx::new(tcx, DUMMY_SP, typing_env.param_env, DummyMachine),
|
||||
ecx: InterpCx::new(tcx, DUMMY_SP, typing_env, DummyMachine),
|
||||
typing_env,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -125,8 +125,7 @@ impl<'tcx> crate::MirPass<'tcx> for GVN {
|
|||
// Clone dominators because we need them while mutating the body.
|
||||
let dominators = body.basic_blocks.dominators().clone();
|
||||
|
||||
let mut state =
|
||||
VnState::new(tcx, body, typing_env.param_env, &ssa, dominators, &body.local_decls);
|
||||
let mut state = VnState::new(tcx, body, typing_env, &ssa, dominators, &body.local_decls);
|
||||
ssa.for_each_assignment_mut(
|
||||
body.basic_blocks.as_mut_preserves_cfg(),
|
||||
|local, value, location| {
|
||||
|
@ -266,7 +265,7 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
|
|||
fn new(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
body: &Body<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
typing_env: ty::TypingEnv<'tcx>,
|
||||
ssa: &'body SsaLocals,
|
||||
dominators: Dominators<BasicBlock>,
|
||||
local_decls: &'body LocalDecls<'tcx>,
|
||||
|
@ -280,7 +279,7 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
|
|||
+ 4 * body.basic_blocks.len();
|
||||
VnState {
|
||||
tcx,
|
||||
ecx: InterpCx::new(tcx, DUMMY_SP, param_env, DummyMachine),
|
||||
ecx: InterpCx::new(tcx, DUMMY_SP, typing_env, DummyMachine),
|
||||
local_decls,
|
||||
locals: IndexVec::from_elem(None, local_decls),
|
||||
rev_locals: IndexVec::with_capacity(num_values),
|
||||
|
@ -295,7 +294,7 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
|
|||
}
|
||||
|
||||
fn typing_env(&self) -> ty::TypingEnv<'tcx> {
|
||||
self.ecx.typing_env()
|
||||
self.ecx.typing_env
|
||||
}
|
||||
|
||||
#[instrument(level = "trace", skip(self), ret)]
|
||||
|
|
|
@ -82,7 +82,7 @@ impl<'tcx> crate::MirPass<'tcx> for JumpThreading {
|
|||
let mut finder = TOFinder {
|
||||
tcx,
|
||||
typing_env,
|
||||
ecx: InterpCx::new(tcx, DUMMY_SP, typing_env.param_env, DummyMachine),
|
||||
ecx: InterpCx::new(tcx, DUMMY_SP, typing_env, DummyMachine),
|
||||
body,
|
||||
arena,
|
||||
map: Map::new(tcx, body, Some(MAX_PLACES)),
|
||||
|
|
|
@ -183,7 +183,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
|
|||
// to runtime, so we have to manually specify the correct typing mode.
|
||||
let typing_env = ty::TypingEnv::post_analysis(tcx, body.source.def_id());
|
||||
let can_const_prop = CanConstProp::check(tcx, typing_env, body);
|
||||
let ecx = InterpCx::new(tcx, tcx.def_span(def_id), typing_env.param_env, DummyMachine);
|
||||
let ecx = InterpCx::new(tcx, tcx.def_span(def_id), typing_env, DummyMachine);
|
||||
|
||||
ConstPropagator {
|
||||
ecx,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue