Uh oh!
There was an error while loading. Please reload this page.
MIR: use HirId instead of NodeId to avoid cycles while inlining - #71285
Conversation
rust-highfive
commented
Apr 18, 2020
r? @varkor (rust_highfive has picked a reviewer for you, use r? to override) |
Uh oh!
There was an error while loading. Please reload this page.
b716e9e to
81d7283CompareUh oh!
There was an error while loading. Please reload this page.
81d7283 to
a270ba6Comparevarkor
commented
Apr 19, 2020
This seems reasonable, but I'm not familiar enough with the subtleties to be sure, so reassigning to the reviewer of the linked PR. |
#71197 only needed to sort things so that error messages would be produced in source order. In this case, we need to define an arbitrary order for all callable functions to avoid inlining cycles. Why not use the Also, I don't believe perf runs have MIR inlining enabled. If that's true, any slowdown caused by looking up all these spans wouldn't have been visible. |
ljedrz
commented
Apr 19, 2020
If the order can be arbitrary then it makes sense to just use |
I don't know. The goal is to have the exact same optimizations applied across incremental runs. If you can prove that is indeed what happens, then have at it. However, I suspect that if it were that simple, |
bjorn3
commented
Apr 19, 2020
A part of a rust/src/librustc_hir/definitions.rs Lines 35 to 45 in df768c5 This means that if functions are reordered, comparing the order of the |
a270ba6 to
144ca6bCompare144ca6b to
3c455feCompareecstatic-morse
commented
Apr 19, 2020
@bors r+ @ljedrz Feel free to explore the interaction between incremental and the current approach to avoiding inlining cycles. Note that more robust approach to MIR inlining in cyclic call graphs would eliminate that issue, along with several others. This is not a simple problem, however. See #43542. |
bors
commented
Apr 19, 2020
📌 Commit 3c455fe has been approved by |
Rollup of 4 pull requests Successful merges: - rust-lang#69362 (Stabilize most common subset of alloc_layout_extras) - rust-lang#71174 (Check that main/start is not async) - rust-lang#71285 (MIR: use HirId instead of NodeId to avoid cycles while inlining) - rust-lang#71346 (Do not build tools if user do not want them) Failed merges: r? @ghost
I wanted to see if I could limit the number of uses of
NodeIdwhenHirIdis available and I saw that some of the MIRInlinercode could useSpaninstead ofNodeId, not unlike in #71197.If I'm understanding the reason for not callingoptimized_mirin incremental builds here correctly, this change could also allow us to do so.This change could affect performance, so if this approach makes sense, a perf run is probably a good idea.