Commit Graph

6 Commits

Author SHA1 Message Date
Alexander Cyon
4a2942bb4e Fix typos in: cmake, tools, utils, unittests, validation-test
Co-authored-by: Saleem Abdulrasool <compnerd@compnerd.org>
2024-07-12 02:34:00 +03:00
Erik Eckstein
09b443d9e3 IRGen: fix emission of constant single-case enums without payload
This is a follow-up of https://github.com/apple/swift/pull/68516 which didn't handle the no-payload case correctly

Fixes a compiler crash

rdar://115666971
2023-09-19 10:28:51 +02:00
Erik Eckstein
9cf0229824 IRGen: fix emission of constant single-case enums
Enums which have a single case with a payload were emitted with wrong field alignement into the data section.

Fixes a miscompile:
rdar://115251963
2023-09-14 12:17:06 +02:00
Erik Eckstein
a3822cd2c5 IRGen: fix a problem with 24-bit enum payloads in statically initialized global variables
IRGen crashed in case an enum, which has a 24 bit payload (e.g. three `UInt8`), is used as a payload of another enum, e.g. `Optional`, in a statically initialized global variable.

rdar://112823823
2023-07-26 15:36:31 +02:00
Erik Eckstein
92fab06d96 IRGen: fix generation of static enums with function payloads
fixes a compiler crash

rdar://109999583
2023-05-31 14:22:48 +02:00
Erik Eckstein
fe367e8013 Optimizer/IRGen: allow enums in static initializers of globals
The main change here is in IRGen which needs to be able to emit constant enum values.
Use `emitValueInjection` to create the enum constant.
Usually this method creates code in the current function.
But if all arguments to the enum are constant, the builder never has to emit an instruction.
Instead it can constant fold everything and just returns the final constant.

Also, create statically initialized let-globals as constant global (`constant` instead of `global`).
2023-05-25 16:28:41 +02:00