Kuba Mracek
ed5e89a501
Also respect -mergeable-traps when merging cond_fails in SILOptimizer
2025-03-24 09:04:44 -07:00
Andrew Trick
afb0de5d3f
LifetimeDependence: enable addressable dependencies
2025-03-23 19:00:42 -07:00
Andrew Trick
fa64a362a2
Add -Xfrontend -enable-address-dependencies
...
Temporary option to bootstrap '@'_addressable enforcement.
Once all the SILGen cases are handled, we won't need this option.
2025-03-03 16:21:48 -08:00
Meghana Gupta
008e10c2ec
Move OSSA lowering to beyond high level passes
2025-01-30 17:10:03 -08:00
Ben Barham
a2fda1d9f3
[Embedded] Do not produce cannot_specialize_class for live issues
...
SourceKit explicitly disables WMO, silence the diagnostic in this case
(but leave it enabled for explicit non-WMO builds otherwise).
2024-12-19 15:31:41 -08:00
Meghana Gupta
8b1ecb8a71
Add new flag -sil-ownership-verify-all
...
This flag enables ownership verification after every transform.
2024-12-12 23:55:37 -08:00
Arnold Schwaighofer
34c417d9ff
Merge pull request #77379 from aschwaighofer/enable_aggressive_reg2mem
...
Enable heuristic that tries to keep large values in memory
2024-11-06 11:36:33 -08:00
Meghana Gupta
c0a55e11d4
Merge pull request #77314 from meg-gupta/ossaflag
...
Remove -enable-ossa-modules for Synchronization and Distributed
2024-11-04 02:40:54 -08:00
Meghana Gupta
3c29c5e4f1
Add a new flag -enable-recompilation-to-ossa-module
2024-11-02 17:04:07 -07:00
Arnold Schwaighofer
c554ae1519
Enable UseAggressiveReg2MemForCodeSize
2024-10-31 13:28:22 -07:00
Arnold Schwaighofer
328b8695f3
Add a SILOption to control whether we should use an aggressive form of
...
keeping large values indirect
2024-10-30 08:43:22 -07:00
Kavon Farvardin
ba0aac3f39
Merge pull request #76093 from kavon/coldsplit-2
...
ColdBlockInfo: overhaul analysis pass
2024-09-12 16:06:07 -07:00
Kavon Farvardin
7203a4fa73
ColdBlockInfo: overhaul analysis pass
...
The old analysis pass doesn't take into account profile data, nor does
it consider post-dominance. It primarily dealt with _fastPath/_slowPath.
A block that is dominated by a cold block is itself cold. That's true
whether it's forwards or backwards dominance.
We can also consider a call to any `Never` returning function as a
cold-exit, though the block(s) leading up to that call may be executed
frequently because of concurrency. For now, I'm ignoring the concurrency
case and assuming it's cold. To make use of this "no return" prediction,
use the `-enable-noreturn-prediction` flag, which is currently off by
default.
2024-09-03 15:41:10 -07:00
Nate Chandler
7600794838
[LifetimeCompletion] Enable.
...
Now that the compile time regressions observed in rdar://132552637 are
fixed, enable completion of lifetimes during the SILGenCleanup.
2024-08-26 16:24:57 -07:00
Nate Chandler
2e348c7065
[Gardening] Clarify SILOptions flag docs.
...
Specifically, those pertaining to lifetime completion.
2024-08-26 14:56:25 -07:00
Kuba Mracek
80056c15cd
[embedded] Explicitly disable PerfDiags from SourceKit instead of always disabling when WMO is off
2024-08-10 14:50:22 -07:00
Kavon Farvardin
d373f6f604
NFC: throws prediction frontend flag
2024-08-08 11:18:22 -04:00
Ellie Shin
18681c43fb
Drop experimental prefixes from PackageCMO flags.
...
Deprecate experimental- flags with prompts to use the proper flags.
rdar://131498517
2024-07-10 16:19:16 -07:00
Augusto Noronha
4aec4e7cc4
Remove dependency of SILFunction in IRGenOptions
...
SILFunction::shouldBePreservedForDebugger checks if some optimizations
are enabled to decide whether a function should be preserved so its
accessible form the debugger or not. Some of these settings used to live
only in IRGenOptions making SILFunction depend on IRGenOptions.
2024-05-21 15:30:15 -07:00
Kshitij
fd609846ae
Makes the swift-based closure-spec pass an experimental frontend feature
2024-05-02 09:14:05 -07:00
Andrew Trick
38d9557481
Options for complete OSSA lifetimes.
...
Adds
-disable-ossa-complete-lifetimes,
-enable-ossa-verify-complete,
-disable-ossa-verify-complete
2024-03-21 16:32:10 -07:00
Ellie Shin
6fc909837f
Set EnableSerializePackage to false and update call sites.
...
Update doc comments.
rdar://124651962
2024-03-15 14:11:36 -07:00
Ellie Shin
a3250e426d
Support Package CMO
...
* Add a new flag -experimental-package-cmo that requires -experimental-allow-non-resilient-access.
* Support serializing package decls for CMO in package if enabled.
* Only applies to default mode CMO.
* Unlike the existing CMO, package CMO can be built with -enable-library-evolution as package
modules are required to be built together in the same project.
* Create hasPublicOrPackageVisibility to opt in for package decls; needed for CMO, SILVerifier,
and other call sites that verify or determine codegen.
Resolves rdar://121976014
2024-03-12 15:00:24 -07:00
Andrew Trick
093aed967c
Enable lifetime dependence diagnostics for Nonescapable types.
...
Adds -Xfrontend -disable-lifetime-dependence-diagnostics.
Removes -Xllvm -enable-lifetime-dependence-insertion
Removes -Xllvm -enable-lifetime-dependence-diagnostics
2024-03-07 13:40:25 -08:00
Erik Eckstein
3488cd364f
SIL: remove instruction leaks checking
...
It's not thread safe and can cause false alarms in case multiple modules exist in different threads. E.g. when building swiftmodules from interfaces.
The leaking check is not important anymore because the builder APIs enforce that instructions are not leaking.
I.e. it's not possible to create an instruction without inserting it into a basic block. Also, it's not possible to remove an instruction from a block without deleting it.
rdar://122169263
2024-02-22 14:09:11 +01:00
Nate Chandler
af1da401d9
[Frontend] Removed dead case.
...
It is no longer possible to have no lexical markers. Remove the
corresponding case.
2024-02-05 17:39:01 -08:00
Kuba Mracek
ff1f8adac8
[embedded] Implement non-allocating embedded Swift mode, under -no-allocations flag
2023-12-11 09:00:50 -08:00
Allan Shortlidge
f131c8a3f5
Frontend: Introduce -experimental-skip-non-exportable-decls.
...
Rename -experimental-serialize-external-decls only to
-experimental-skip-non-exportable-decls in preparation for the flag being used
to influence more than just serialization.
Resolves rdar://116771543
2023-10-10 16:07:04 -07:00
Kuba Mracek
8b1aca9ff5
[embedded] Only run the late DeadFunctionElimination if embedded mode is on
2023-09-26 22:55:53 -07:00
Kuba Mracek
770dcd1614
[embedded] Make CMO's 'serialize everything' mode even more aggressive and allow serialization of private and shared functions
2023-09-23 13:38:41 -07:00
eeckstein
2a039b412c
Revert "[embedded] Make CMO's 'serialize everything' mode even more aggressive and allow serialization of private and shared functions"
2023-09-23 19:13:04 +02:00
Kuba Mracek
d8907ceec2
[embedded] Make CMO's 'serialize everything' mode even more aggressive and allow serialization of private and shared functions
2023-09-21 16:35:58 -07:00
Kavon Farvardin
b688a1f4a1
[SILOpt] experimental async demotion pass
...
For chains of async functions where suspensions can be statically
proven to never be required, this pass removes all suspensions and
turns the functions into synchronous functions.
For example, this function does not actually require any suspensions,
once the correct executor is acquired upon initial entry:
```
func fib(_ n: Int) async -> Int {
if n <= 1 { return n }
return await fib(n-1) + fib(n-2)
}
```
So we can turn the above into this for better performance:
```
func fib() async -> Int {
return fib_sync()
}
func fib_sync(_ n: Int) -> Int {
if n <= 1 { return n }
return fib(n-1) + fib(n-2)
}
```
while rewriting callers of `fib` to use the `sync` entry-point
when we can prove that it will be invoked on a compatible executor.
This pass is currently experimental and under development. Thus, it
is disabled by default and you must use
`-enable-experimental-async-demotion` to try it.
2023-09-21 12:21:02 -07:00
Nate Chandler
c5699c9eb7
[IRGen] Enabled pack metadata stack promo.
...
Set the flag and updated the tests.
2023-06-05 08:11:28 -07:00
Nate Chandler
e200f164a9
[Frontend] Add flag for pack metadata stack promo.
2023-06-05 08:11:27 -07:00
Erik Eckstein
85052a1489
deprecate the -experimental-performance-annotations option
...
Performance annotations can now be used without specifying this option
2023-05-11 08:03:19 +02:00
Nate Chandler
1a7c4a4d12
[NFC] Renamed DestroyAddrHoisting.
...
It was previously named SSADestroyHoisting which is rather misleading
considering that it deals with addresses and hoists destroy_addrs.
2023-03-27 14:15:03 -07:00
Andrew Trick
2743b83b8e
Added option: -enable-ossa-complete-lifetimes
...
Disabled by default during initial testing.
2023-03-01 21:41:46 -08:00
Meghana Gupta
a515e0db8e
Add EnableImportPtrauthFieldFunctionPointers flag
2023-01-25 12:37:57 -08:00
Artem Chikin
990b95e9d8
[Dependency Scanning] Key into a global (shared) dependency scanning cache via context hash
...
Introduces a concept of a dependency scanning action context hash, which is used to select an instance of a global dependency scanning cache which gets re-used across dependency scanning actions.
2022-12-06 08:26:28 -08:00
Erik Eckstein
ef302ce4ac
SILOptimizer: enable stack protection by default
...
The pass to decide which functions should get stack protection was added in https://github.com/apple/swift/pull/60933 , but was disabled by default.
This PR enables stack protection by default, but not the possibility to move arguments into temporaries - to keep the risk low.
Moving to temporaries can be enabled with the new frontend option `-enable-move-inout-stack-protector`.
rdar://93677524
2022-11-11 17:14:08 +01:00
Erik Eckstein
3e1ff0a5b7
IRGen: move the EnableStackProtector option from IRGenOptions to SILOptions.
...
... because we need it in the SIL pass pipeline, too.
Also, add Swift bridging for that option.
2022-09-08 08:42:24 +02:00
Erik Eckstein
abb2da88e6
Add a flag -enable-default-cmo to enable default cross-module-optimization.
...
So far, the swift-frontend decided by itself if CMO can be enabled. This caused problems when used with an old driver, which doesn't consider CMO.
Now, the driver decides when to use default CMO by passing this flag to swift-frontend.
2022-04-29 18:22:55 +02:00
Josh Soref
81d3ad76ac
Spelling ast ( #42463 )
...
* spelling: accessor
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: accommodates
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: argument
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: associated
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: availability
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: available
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: belongs
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: bookkeeping
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: building
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: clazz
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: clonable
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: closure
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: concatenated
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: conformance
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: context
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: conversion
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: correspondence
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: declarations
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: declared
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: defining
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: delayed
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: dependency
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: deployed
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: descendants
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: diagnose
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: diagnostic
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: equitable
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: evaluation
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: exclusivity
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: existence
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: existential
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: explicit
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: expressed
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: for
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: foreign
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: function
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: identifier
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: implicit
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: indices
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: information
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: instance
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: interchangeable
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: interface
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: introduced
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: invalid
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: kind-in
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: least
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: library
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: location
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: namespace
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: necessary
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: nonexistent
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: not
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: number
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: obtains
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: occurs
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: opaque
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: overridden
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: parameter
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: precede
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: preceding
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: property
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: protocol
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: qualified
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: recognized
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: recursively
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: references
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: relaxing
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: represented
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: request
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: requirement
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: requirements
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: retrieve
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: returned
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: satisfied
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: satisfy
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: scanner
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: siblings
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: simplified
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: something
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: source
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: specializations
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: specially
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: statement
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: stripped
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: structure
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: substitution
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: the
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: transform
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: transformed
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: transitively
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: transparent
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: typecheck
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: unknown
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: unlabeled
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: unqualified
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: whether
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: with
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: scanner
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
Co-authored-by: Josh Soref <jsoref@users.noreply.github.com >
2022-04-21 12:57:16 -07:00
Nate Chandler
11e5c97f45
[SILOpt] Added flag to disable destroy hoisting.
...
It is on by default. The default changes with the value of the
CopyPropagation setting. But it can still be overridden.
2022-04-05 20:01:17 -07:00
Andrew Trick
8a7e955b0d
Move -enable-sil-opaque-value to SILOptions.
2022-03-09 17:18:15 -08:00
Erik Eckstein
1dfb3b1a2a
cross-module-optimization: be more conservative when emitting a TBD file.
...
If we are emitting a TBD file, the TBD file only contains public symbols of this module.
But not public symbols of imported modules which are statically linked to the current binary.
This prevents referencing public symbols from other modules which could (potentially) linked statically.
Unfortunately there is no way to find out if another module is linked statically or dynamically, so we have to be conservative.
Fixes an unresolved-symbol linker error.
rdar://89364148
2022-03-03 11:42:07 +01:00
Nate Chandler
7d7acb4a53
Enabled copy propagation by default.
2021-12-16 15:29:34 -08:00
Nate Chandler
59ae5180ba
[NFC] Used SILOption field for copy propagation.
...
Replaced the quad-state (of state which one was illegal) of two booleans
(EnableCopyPropagation and DisableCopyPropagation) with an enum.
2021-12-13 17:44:28 -08:00
Nate Chandler
1464c1b1ff
[NFC] Renamed LexicalLifetimesOption cases.
...
The cases' new names more accurately reflect what behavior occurs when
SILOptions::LexicalLifetimes is assigned that case.
2021-12-10 18:36:28 -08:00