about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src/inline.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-09-17 09:35:10 +0000
committerbors <bors@rust-lang.org>2024-09-17 09:35:10 +0000
commit46b0f8bafcf11fa1d6b6c172f4f5c1b95c11ebdb (patch)
treee5fa15764de7a11008b94b468ca21132b38e6354 /compiler/rustc_mir_transform/src/inline.rs
parent2e367d94f05f3c6170f4d49f5e387cfaa0c42c32 (diff)
parent8f97231d34faa8a691d1c35232fc4044fbc67bd5 (diff)
downloadrust-46b0f8bafcf11fa1d6b6c172f4f5c1b95c11ebdb.tar.gz
rust-46b0f8bafcf11fa1d6b6c172f4f5c1b95c11ebdb.zip
Auto merge of #130455 - compiler-errors:inline-ordering, r=saethlin
Remove semi-nondeterminism of `DefPathHash` ordering from inliner

Déjà vu or something because I kinda thought I had put this PR up before. I recall a discussion somewhere where I think it was `@saethlin` mentioning that this check was no longer needed since we have "proper" cycle detection. Putting that up as a PR now.

This may slighlty negatively affect inlining, since the cycle breaking here means that we still inlined some cycles when the def path hashes were ordered in certain ways, this leads to really bad nondeterminism that makes minimizing ICEs and putting up inliner bugfixes difficult.

r? `@cjgillot` or `@saethlin` or someone else idk
Diffstat (limited to 'compiler/rustc_mir_transform/src/inline.rs')
-rw-r--r--compiler/rustc_mir_transform/src/inline.rs10
1 files changed, 0 insertions, 10 deletions
diff --git a/compiler/rustc_mir_transform/src/inline.rs b/compiler/rustc_mir_transform/src/inline.rs
index 870cb180ce1..2de75e2ef50 100644
--- a/compiler/rustc_mir_transform/src/inline.rs
+++ b/compiler/rustc_mir_transform/src/inline.rs
@@ -357,16 +357,6 @@ impl<'tcx> Inliner<'tcx> {
         }
 
         if callee_def_id.is_local() {
-            // Avoid a cycle here by only using `instance_mir` only if we have
-            // a lower `DefPathHash` than the callee. This ensures that the callee will
-            // not inline us. This trick even works with incremental compilation,
-            // since `DefPathHash` is stable.
-            if self.tcx.def_path_hash(caller_def_id).local_hash()
-                < self.tcx.def_path_hash(callee_def_id).local_hash()
-            {
-                return Ok(());
-            }
-
             // If we know for sure that the function we're calling will itself try to
             // call us, then we avoid inlining that function.
             if self.tcx.mir_callgraph_reachable((callee, caller_def_id.expect_local())) {