[SR-11452] Swift Failing To Properly Optimize Inout Parameter Unless It's Manually Copied #53853
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
performance
Additional Detail from JIRA
md5: cf5ea9a7793e87fea8c4b887c1b3440d
Issue Description:
Expected behavior: a function that directly uses an inout parameter is exactly equivalent to one that copies the inout variable into a local at the beginning then copies it back out at the end.
Actual behavior: the code that uses the inout parameter directly is an order of magnitude slower than the code that manually copies the inout variable.
Tested in Apple Swift 5.0
The text was updated successfully, but these errors were encountered: