-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Suboptimal inlining decisions #49541
Copy link
Copy link
Open
Labels
A-codegenArea: Code generationArea: Code generationC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.WG-llvmWorking group: LLVM backend code generationWorking group: LLVM backend code generation
Metadata
Metadata
Assignees
Labels
A-codegenArea: Code generationArea: Code generationC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.WG-llvmWorking group: LLVM backend code generationWorking group: LLVM backend code generation
Type
Fields
Give feedbackNo fields configured for issues without a type.
I suspect this can happen in more cases, but here is how I observed this:
This compiles to:
Which is pretty much to the point.
Now duplicate the function, so that you now have two functions calling
into_boxed_slice(), and the compiler decides not to inline it at all anymore. Which:Vec::into_boxed_sliceimplementation (63 lines of assembly)ptr::drop_in_placeThe threshold to stop inlining seems pretty low for this particular case, and even if it might make sense for some uses across the codebase to not be inlined, when the result of inlining is clearly beneficial, it would be good if we could still inline the calls where it's a win.