Closed
Description
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.