Use param_env_reveal_all_normalized in MIR opts.
This commit is contained in:
parent
7efcf67a3b
commit
4fe51365d7
7 changed files with 10 additions and 8 deletions
|
@ -323,7 +323,7 @@ impl<'tcx> std::fmt::Debug for ScalarTy<'tcx> {
|
||||||
|
|
||||||
impl<'a, 'tcx> ConstAnalysis<'a, 'tcx> {
|
impl<'a, 'tcx> ConstAnalysis<'a, 'tcx> {
|
||||||
pub fn new(tcx: TyCtxt<'tcx>, body: &'a Body<'tcx>, map: Map) -> Self {
|
pub fn new(tcx: TyCtxt<'tcx>, body: &'a Body<'tcx>, map: Map) -> Self {
|
||||||
let param_env = tcx.param_env(body.source.def_id());
|
let param_env = tcx.param_env_reveal_all_normalized(body.source.def_id());
|
||||||
Self {
|
Self {
|
||||||
map,
|
map,
|
||||||
tcx,
|
tcx,
|
||||||
|
|
|
@ -120,7 +120,7 @@ impl EnumSizeOpt {
|
||||||
fn optim<'tcx>(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
fn optim<'tcx>(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||||
let mut alloc_cache = FxHashMap::default();
|
let mut alloc_cache = FxHashMap::default();
|
||||||
let body_did = body.source.def_id();
|
let body_did = body.source.def_id();
|
||||||
let param_env = tcx.param_env(body_did);
|
let param_env = tcx.param_env_reveal_all_normalized(body_did);
|
||||||
|
|
||||||
let blocks = body.basic_blocks.as_mut();
|
let blocks = body.basic_blocks.as_mut();
|
||||||
let local_decls = &mut body.local_decls;
|
let local_decls = &mut body.local_decls;
|
||||||
|
|
|
@ -46,7 +46,7 @@ impl<'tcx> MirPass<'tcx> for MatchBranchSimplification {
|
||||||
|
|
||||||
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||||
let def_id = body.source.def_id();
|
let def_id = body.source.def_id();
|
||||||
let param_env = tcx.param_env(def_id);
|
let param_env = tcx.param_env_reveal_all_normalized(def_id);
|
||||||
|
|
||||||
let bbs = body.basic_blocks.as_mut();
|
let bbs = body.basic_blocks.as_mut();
|
||||||
let mut should_cleanup = false;
|
let mut should_cleanup = false;
|
||||||
|
|
|
@ -355,7 +355,7 @@ fn build_thread_local_shim<'tcx>(tcx: TyCtxt<'tcx>, instance: ty::InstanceDef<'t
|
||||||
fn build_clone_shim<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, self_ty: Ty<'tcx>) -> Body<'tcx> {
|
fn build_clone_shim<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, self_ty: Ty<'tcx>) -> Body<'tcx> {
|
||||||
debug!("build_clone_shim(def_id={:?})", def_id);
|
debug!("build_clone_shim(def_id={:?})", def_id);
|
||||||
|
|
||||||
let param_env = tcx.param_env(def_id);
|
let param_env = tcx.param_env_reveal_all_normalized(def_id);
|
||||||
|
|
||||||
let mut builder = CloneShimBuilder::new(tcx, def_id, self_ty);
|
let mut builder = CloneShimBuilder::new(tcx, def_id, self_ty);
|
||||||
let is_copy = self_ty.is_copy_modulo_regions(tcx, param_env);
|
let is_copy = self_ty.is_copy_modulo_regions(tcx, param_env);
|
||||||
|
@ -836,7 +836,7 @@ fn build_call_shim<'tcx>(
|
||||||
pub fn build_adt_ctor(tcx: TyCtxt<'_>, ctor_id: DefId) -> Body<'_> {
|
pub fn build_adt_ctor(tcx: TyCtxt<'_>, ctor_id: DefId) -> Body<'_> {
|
||||||
debug_assert!(tcx.is_constructor(ctor_id));
|
debug_assert!(tcx.is_constructor(ctor_id));
|
||||||
|
|
||||||
let param_env = tcx.param_env(ctor_id);
|
let param_env = tcx.param_env_reveal_all_normalized(ctor_id);
|
||||||
|
|
||||||
// Normalize the sig.
|
// Normalize the sig.
|
||||||
let sig = tcx
|
let sig = tcx
|
||||||
|
|
|
@ -16,7 +16,7 @@ impl<'tcx> MirPass<'tcx> for SimplifyConstCondition {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||||
let param_env = tcx.param_env(body.source.def_id());
|
let param_env = tcx.param_env_reveal_all_normalized(body.source.def_id());
|
||||||
for block in body.basic_blocks_mut() {
|
for block in body.basic_blocks_mut() {
|
||||||
let terminator = block.terminator_mut();
|
let terminator = block.terminator_mut();
|
||||||
terminator.kind = match terminator.kind {
|
terminator.kind = match terminator.kind {
|
||||||
|
|
|
@ -37,7 +37,7 @@ impl<'tcx> MirPass<'tcx> for SimplifyComparisonIntegral {
|
||||||
let opts = helper.find_optimizations();
|
let opts = helper.find_optimizations();
|
||||||
let mut storage_deads_to_insert = vec![];
|
let mut storage_deads_to_insert = vec![];
|
||||||
let mut storage_deads_to_remove: Vec<(usize, BasicBlock)> = vec![];
|
let mut storage_deads_to_remove: Vec<(usize, BasicBlock)> = vec![];
|
||||||
let param_env = tcx.param_env(body.source.def_id());
|
let param_env = tcx.param_env_reveal_all_normalized(body.source.def_id());
|
||||||
for opt in opts {
|
for opt in opts {
|
||||||
trace!("SUCCESS: Applying {:?}", opt);
|
trace!("SUCCESS: Applying {:?}", opt);
|
||||||
// replace terminator with a switchInt that switches on the integer directly
|
// replace terminator with a switchInt that switches on the integer directly
|
||||||
|
|
|
@ -109,7 +109,9 @@ impl<'tcx> MirPass<'tcx> for UninhabitedEnumBranching {
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
|
|
||||||
let layout = tcx.layout_of(tcx.param_env(body.source.def_id()).and(discriminant_ty));
|
let layout = tcx.layout_of(
|
||||||
|
tcx.param_env_reveal_all_normalized(body.source.def_id()).and(discriminant_ty),
|
||||||
|
);
|
||||||
|
|
||||||
let allowed_variants = if let Ok(layout) = layout {
|
let allowed_variants = if let Ok(layout) = layout {
|
||||||
variant_discriminants(&layout, discriminant_ty, tcx)
|
variant_discriminants(&layout, discriminant_ty, tcx)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue