Commit Graph

5 Commits

Author SHA1 Message Date
Erik Eckstein
c8e74b8393 Generic specialization: change the mangling for dropped metatype arguments
Instead of adding a "flag" (`m` in `...Tgm5`) make it more generic to allow to drop any unused argument.
Add all dropped arguments with a `t<n-1>` (where `<n-1>` is empty for n === 0). For example `...Ttt2g5`.
2024-08-26 10:43:15 +02:00
Erik Eckstein
7839b54b8a GenericSpecializer: drop metatype arguments in specialized functions
And replace them with explicit `metatype` instruction in the entry block.
This allows such metatype instructions to be deleted if they are dead.

This was already done for performance-annotated functions. But now do this for all functions.

It is essential that performance-annotated functions are specialized in the same way as other functions.
Because otherwise it can happen that the same specialization has different performance characteristics in different modules.
And it's up to the linker to select one of those ODR functions when linking.

Also, dropping metatype arguments is good for performance and code size in general.

This change also contains a few bug fixes for dropping metatype arguments.

rdar://110509780
2023-06-15 21:42:01 +02:00
Erik Eckstein
91d00ac170 tests: re-enable SILOptimizer/set.swift
And make it more robust.

rdar://102865253
2022-12-02 11:12:23 +01:00
Evan Wilde
320cb24bfe Disable SILOptimizer/set.swift
This test is failing on the macOS package bot. Disabling for now.
2022-12-01 10:30:37 -08:00
Erik Eckstein
126f3e14c1 stdlib: create optimal code for initializing a Set with an empty array literal
Always inline the empty-array-check of `Set.init(arrayLiteral:)`, because for array literal this check can always be constant folded.

rdar://53509655
2022-12-01 07:02:22 +01:00