[SR-14101] Swift doesn't make global constants for constant arrays (should hoist array into global) #56487
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Environment
Additional Detail from JIRA
md5: 0f7004f7b8d04ae169dc87f69726168c
Issue Description:
consider this program
The intermediate array is generated on each function invocation which generates a lot of code (and adds runtime overhead). I would've hoped that Swift realises that the array is in fact constant, then it could've put that in a global and initialised it just once.
The code looks like (with both
-O
and-Osize
)The text was updated successfully, but these errors were encountered: