Commit Graph

13 Commits

Author SHA1 Message Date
Erik Eckstein
bd5d4276cd SILCombine: fix keypath optimization with optional chaining and classes
For optional chaining a swift_enum is created.
If the sub-projection is ending a begin_access in the some-branch, it also needs to be ended in the none-branch.

Fixes a compiler crash and/or a miscompile.

https://bugs.swift.org/browse/SR-14534
rdar://77224220
2021-04-30 21:47:42 +02:00
Joe Groff
c5863ac0f3 SILOptimizer: Constant fold the _kvcKeyPathString of literal key paths.
Eliminate the intermediate key path object when a literal key path is passed to a function that
just wants its KVC string to pass down to an ObjC API.
2020-05-07 13:33:01 -07:00
Erik Eckstein
5406a81d6c SILOptimizer: fix a crash in the keypath optimization
Use the correct type lowering.

rdar://problem/61122088
2020-04-02 10:44:18 +02:00
Jonathan Keller
e603183fb2 [SILOptimizer] fix overrelease in KeyPathProjector
Because parentValue is the result of a setter projection, it is uninitalized and should not be destroyed again (see 1feead8)
2020-02-21 15:34:18 -08:00
Jonathan Keller
620fba6a1f [SILOptimizer] fix KeyPathProjector memory management
I was inconsistently providing initialized or uninitialized memory
to the callback when projecting a settable address, depending on
component type. We should always provide an uninitialized address.
2020-02-21 15:34:17 -08:00
Jonathan Keller
d9976bd7fa [SILOptimizer] fix crash in key path projector
When a computed property returns a generic, the accessor's function
type may involve a type parameter that needs to be resolved using
the key path instruction's substitution map.
2020-02-21 15:34:17 -08:00
Jonathan Keller
b2ab82bb76 [SILOptimizer] address key path projection review feedback 2020-02-21 15:34:17 -08:00
Jonathan Keller
44d211fa17 [SILOptimizer] Generalize optimization of static keypaths
We have an optimization in SILCombiner that "inlines" the use of compile-time constant key paths by performing the property access directly instead of calling a runtime function (leading to huge performance gains e.g. for heavy use of @dynamicMemberLookup). However, this optimization previously only supported key paths which solely access stored properties, so computed properties, optional chaining, etc. still had to call a runtime function. This commit generalizes the optimization to support all types of key paths.
2020-02-21 15:34:17 -08:00
Joe Groff
f353c40ce9 Revert "[SILOptimizer] Generalize optimization of static keypaths" 2020-02-19 19:58:15 -08:00
Jonathan Keller
1feead804b [SILOptimizer] fix KeyPathProjector memory management
I was inconsistently providing initialized or uninitialized memory
to the callback when projecting a settable address, depending on
component type. We should always provide an uninitialized address.
2020-02-15 15:10:25 -08:00
Jonathan Keller
d7acf12158 [SILOptimizer] fix crash in key path projector
When a computed property returns a generic, the accessor's function
type may involve a type parameter that needs to be resolved using
the key path instruction's substitution map.
2020-02-13 12:53:07 -08:00
Jonathan Keller
48132ea223 [SILOptimizer] address key path projection review feedback 2020-02-04 16:03:46 -08:00
Jonathan Keller
e1ceb4f437 [SILOptimizer] Generalize optimization of static keypaths
We have an optimization in SILCombiner that "inlines" the use of compile-time constant key paths by performing the property access directly instead of calling a runtime function (leading to huge performance gains e.g. for heavy use of @dynamicMemberLookup). However, this optimization previously only supported key paths which solely access stored properties, so computed properties, optional chaining, etc. still had to call a runtime function. This commit generalizes the optimization to support all types of key paths.
2019-12-15 14:10:00 -08:00