Skip to content

Commit 97d48be

Browse files
committed
Auto merge of #96965 - oli-obk:flaky_inliner_ice, r=cjgillot
Gracefully handle normalization failures in the prospective inliner cycle detector Preliminary work for adding the regression test in #96950 to our test suite (it was flaky on glacier). If this PR solves the flakiness on glacier, we can then merge #96950
2 parents f001f93 + e02129f commit 97d48be

File tree

1 file changed

+6
-4
lines changed
  • compiler/rustc_mir_transform/src/inline

1 file changed

+6
-4
lines changed

compiler/rustc_mir_transform/src/inline/cycle.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
2-
use rustc_data_structures::sso::SsoHashSet;
1+
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexSet};
32
use rustc_data_structures::stack::ensure_sufficient_stack;
43
use rustc_hir::def_id::{DefId, LocalDefId};
54
use rustc_middle::mir::TerminatorKind;
@@ -45,7 +44,10 @@ crate fn mir_callgraph_reachable<'tcx>(
4544
) -> bool {
4645
trace!(%caller);
4746
for &(callee, substs) in tcx.mir_inliner_callees(caller.def) {
48-
let substs = caller.subst_mir_and_normalize_erasing_regions(tcx, param_env, substs);
47+
let Ok(substs) = caller.try_subst_mir_and_normalize_erasing_regions(tcx, param_env, substs) else {
48+
trace!(?caller, ?param_env, ?substs, "cannot normalize, skipping");
49+
continue;
50+
};
4951
let Some(callee) = ty::Instance::resolve(tcx, param_env, callee, substs).unwrap() else {
5052
trace!(?callee, "cannot resolve, skipping");
5153
continue;
@@ -150,7 +152,7 @@ crate fn mir_inliner_callees<'tcx>(
150152
// Functions from other crates and MIR shims
151153
_ => tcx.instance_mir(instance),
152154
};
153-
let mut calls = SsoHashSet::new();
155+
let mut calls = FxIndexSet::default();
154156
for bb_data in body.basic_blocks() {
155157
let terminator = bb_data.terminator();
156158
if let TerminatorKind::Call { func, .. } = &terminator.kind {

0 commit comments

Comments
 (0)