swift
5b5d6487 - [Opaque Values] Add KeyPath support to the SIL pipeline

Commit
12 days ago
[Opaque Values] Add KeyPath support to the SIL pipeline Enable SILGen, SIL verification, and AddressLowering of `keypath` instructions under -enable-sil-opaque-values. Existing keypath SIL-optimizer tests are extended to exercise the opaque-values pipeline. In opaque-values mode, TypeLowering::handleAddressOnly lowers address-only AST types as objects until AddressLowering runs, so getLoweredType returns the object form for address-only KeyPath index parameters. The keypath runtime ABI requires the address form, and KeyPathPatternComponent caches its lowered index type — AddressLowering does not reconstruct the pattern with refreshed lowerings. Bypass TypeLowering in lowerKeyPathMemberIndexTypes with the static SILType::isAddressOnly (which reads SILTypeProperties directly, skipping handleAddressOnly's opaque-values override) and switch address-only index lowerings to address form during pattern construction. A cleaner fix would either drop the cached lowering from KeyPathPatternComponent::Index, or have AddressLowering rebuild the keypath pattern with refreshed lowerings — both larger refactors, deferred for now.
Author
Committer
Parents
Loading