You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A-codegenArea: Code generationA-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.I-slowIssue: Problems and improvements with respect to performance of generated code.
Functions that take a non-immediate argument by-value are passed that value by-reference. If the argument needs to live in the current function's frame, we copy it to a local stack slot, but otherwise we'll just re-use the storage that is already there.
Unfortunately, LLVM does not understand that the caller cannot see any of the changes that we might make to the value, behind the passed reference. Since passing an argument by-value either a) copies, meaning that the caller already created a temporary slot, or b) moves, meaning that the slot from the caller is dead once the call returns, LLVM could optimise based on this information, we just need to inform it of that fact.
The text was updated successfully, but these errors were encountered:
huonw
added
A-codegen
Area: Code generation
I-slow
Issue: Problems and improvements with respect to performance of generated code.
labels
Jan 22, 2015
sanxiyn
added
the
A-LLVM
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
label
Jan 25, 2015
We emit lifetime end intrinsics in the callee for by-value arguments, so LLVM should actually know that the value is dead. Do you have anything else in mind that we should do?
Maybe implement some optimizations in rustc itself?
Since no other widely-used language has Rust's ownership model, optimizations based on it may be in the purview of rustc, rather than llvm (which must serve multiple frontends).
I believe this is no longer an issue on the LLVM side, and while we can certainly do more optimizations in rustc, there is nothing concrete that could be done to fix this, so I'm going to close this.
A-codegenArea: Code generationA-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.I-slowIssue: Problems and improvements with respect to performance of generated code.
Functions that take a non-immediate argument by-value are passed that value by-reference. If the argument needs to live in the current function's frame, we copy it to a local stack slot, but otherwise we'll just re-use the storage that is already there.
Unfortunately, LLVM does not understand that the caller cannot see any of the changes that we might make to the value, behind the passed reference. Since passing an argument by-value either a) copies, meaning that the caller already created a temporary slot, or b) moves, meaning that the slot from the caller is dead once the call returns, LLVM could optimise based on this information, we just need to inform it of that fact.
The text was updated successfully, but these errors were encountered: