Skip to content

Commit

Permalink
Auto merge of rust-lang#96965 - oli-obk:flaky_inliner_ice, r=cjgillot
Browse files Browse the repository at this point in the history
Gracefully handle normalization failures in the prospective inliner cycle detector

Preliminary work for adding the regression test in rust-lang#96950 to our test suite (it was flaky on glacier).

If this PR solves the flakiness on glacier, we can then merge rust-lang#96950
  • Loading branch information
bors committed May 13, 2022
2 parents f001f93 + e02129f commit 97d48be
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions compiler/rustc_mir_transform/src/inline/cycle.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_data_structures::sso::SsoHashSet;
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexSet};
use rustc_data_structures::stack::ensure_sufficient_stack;
use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_middle::mir::TerminatorKind;
Expand Down Expand Up @@ -45,7 +44,10 @@ crate fn mir_callgraph_reachable<'tcx>(
) -> bool {
trace!(%caller);
for &(callee, substs) in tcx.mir_inliner_callees(caller.def) {
let substs = caller.subst_mir_and_normalize_erasing_regions(tcx, param_env, substs);
let Ok(substs) = caller.try_subst_mir_and_normalize_erasing_regions(tcx, param_env, substs) else {
trace!(?caller, ?param_env, ?substs, "cannot normalize, skipping");
continue;
};
let Some(callee) = ty::Instance::resolve(tcx, param_env, callee, substs).unwrap() else {
trace!(?callee, "cannot resolve, skipping");
continue;
Expand Down Expand Up @@ -150,7 +152,7 @@ crate fn mir_inliner_callees<'tcx>(
// Functions from other crates and MIR shims
_ => tcx.instance_mir(instance),
};
let mut calls = SsoHashSet::new();
let mut calls = FxIndexSet::default();
for bb_data in body.basic_blocks() {
let terminator = bb_data.terminator();
if let TerminatorKind::Call { func, .. } = &terminator.kind {
Expand Down

0 comments on commit 97d48be

Please sign in to comment.