Commit Graph

18 Commits

Author SHA1 Message Date
Erik Eckstein
543fe31e8f SwiftCompilerSources: add Context.notifyDependency(onBodyOf:)
It notifies the pass manager that the optimization result of the current pass depends on the body (i.e. SIL instructions) of another function than the currently optimized one.
2024-01-10 09:34:00 +01:00
Erik Eckstein
bc99986cf9 SIL: add a dependency token operand to global_addr
Optionally, the dependency to the initialization of the global can be specified with a dependency token `depends_on <token>`.
This is usually a `builtin "once"` which calls the initializer for the global variable.
2024-01-10 09:33:58 +01:00
Erik Eckstein
85be96354f SimplifyBuiltin: fix simplification of is_same_metatype with dynamic_self types
Dynamic self types are not the same as non-dynamic self types.

Fixes a miscompile with dynamic self type comparisons.

rdar://119943508
2024-01-02 09:23:42 +01:00
Erik Eckstein
691fa9e755 SimplifyBuiltin: add constant folding of null pointer checks against string literals
A pointer to a string literal is never null
2023-12-15 17:11:50 +01:00
Erik Eckstein
dd9ce40ba1 add the allocVector builtin 2023-12-09 18:49:57 +01:00
Kuba Mracek
5d8c55eacb [embedded] Initial Swift Concurrency for embedded Swift 2023-10-06 20:04:03 -07:00
Kuba Mracek
6a0bfa267d [embedded] Handle thick->thin metatype conversion on IsPOD builtin too 2023-09-20 15:49:13 -07:00
Kuba Mracek
51792d8a31 [embedded] Simplify optimizeArrayBuiltin, avoid needing a single use of the metatype inst 2023-09-15 10:40:19 -07:00
Kuba Mracek
350107e153 [embedded] Also cover DestroyArray builtin in embedded Swift mode 2023-09-15 06:56:11 -07:00
Kuba Mracek
50f6430a27 [embedded] Convert thick->thin metatypes on array builtins (copy, take, assign) in mandatory optimizations 2023-09-14 18:09:08 -07:00
Kuba Mracek
5dac59ce71 Move TargetConstantFolding pass to the simplification passes in Swift, enable using MemoryLayout's .size, .stride, .alignment fields in forced-const global initializers 2023-07-31 10:54:07 -07:00
Erik Eckstein
393711d5f4 SimplifyBuiltin: ignore debug_step and debug_value when checking for side-effects in the callee of a builtin.once 2023-07-26 11:06:50 +02:00
Erik Eckstein
1355e94eca Simplification: simplify builtin "canBeClass" and builtin "assert_configuration" 2023-05-11 08:11:44 +02:00
Erik Eckstein
c4096bc723 Swift Optimizer: simplify builtin "once"
If the callee is side effect-free we can remove the whole builtin "once".
2023-05-08 21:23:36 +02:00
Erik Eckstein
9b51e69dac Swift Optimizer: constant fold builtins in the simplification passes 2023-05-08 21:23:36 +02:00
Erik Eckstein
f1095556c9 Swift SIL: let var UnaryInstruction.operand return an Operand and not a Value
To avoid confusion. Instead add specific getters for unary instructions with dedicated names.

NFC
2023-02-21 17:57:29 +01:00
Erik Eckstein
40ed0fb388 Swift Optimizer: fix a crash when simplifying same-metatype comparisons of function types
The instance type of a metatype instruction is not necessarily a legal lowered SIL Type.
Lower the type before converting it to a SILType.

rdar://105502403
2023-02-15 21:14:32 +01:00
Erik Eckstein
d56ed65718 Swift Optimizer: add Onone simplification of some builtin instructions
* `Builtin.isConcrete`
* `Builtin.is_same_metatype`
2023-02-09 06:50:05 +01:00