Commit Graph

6 Commits

Author SHA1 Message Date
Artem Chikin
d8176a7e89 [Compile Time Values] Add syntactic verification of valid expressions in '@const' contexts
Syntactically verify that initializer expressions of '@const' variables and argument expressions to '@const' parameters consist strictly of syntactically-verifiable set of basic values and operations
2025-05-20 09:38:36 -07:00
Artem Chikin
dfbfb821ad [Test Only] Restrict '@const' test to optimized-stdlib builds 2025-04-22 10:17:32 -07:00
Erik Eckstein
4d1df28de0 ConstantFolding: add constant folding for some floating point intrinsics
* `sitofp` signed integer to floating point
* `rint` round floating point to integral
* `bitcast` between integer and floating point

Constant folding `bitcast`s also made it necessary to rewrite constant folding for Nan and inf values, because the old code explicitly checked for `bitcast` intrinsics.
Relying on constant folded `bitcast`s makes the new version much simpler.

It is important to constant fold these intrinsics already in SIL because it enables other optimizations.
2025-04-01 18:13:01 +02:00
Artem Chikin
281f84da0f [Compile Time Values] Rewrite the 'Diagnose Unknown Compile Time Values' diagnostic pass in Swift 2025-03-28 10:30:07 -07:00
Artem Chikin
114af54875 [Compile Time Values] Rebase on top of newly-added experimental feature for the '@const' attribute 2025-03-27 14:33:38 -07:00
Kuba Mracek
a925d6af20 Add tests 2025-03-27 14:33:37 -07:00