Commit Graph

2211 Commits

Author SHA1 Message Date
Slava Pestov
c8415aeac4 Sema: Record the trail step count in solver statistics
Also introduce two new frontend flags:

The -solver-scope-threshold flag sets the maximum number of scopes, which was
previously hardcoded to 1 million.

The -solver-trail-threshold flag sets the maximum number of trail steps,
which defaults to 64 million.
2024-11-20 13:46:19 -05:00
Artem Chikin
77fde76150 Ignore in-package transitive dependencies when building from non-package textual interface
This change ensures that when loading some module dependency 'Bar' which has a package-only dependency on 'Foo', only the following clients attempt to resolve/load 'Foo':
- Source compilation with package-name equal to that of 'Bar'.
- Textual interface compilation of a *'package'* interface with package-name equal to that of 'Bar'.

Ensuring that the following kinds of clients do not attempt to resolve/load 'Foo':
- Source compilation with package-name different to that of 'Bar'
- Textual interface compilation of a public or private interface, regardless of package name.

This fixes the behavior where previously compilation of a Swift textual interface dependency 'X' from its public or private interface, with an interface-specified package-name, from a client without a matching package-name, resulted in a lookup of package-only dependencies of modules loaded into 'X'. This behavior is invalid if we are not building from the package textual interface, becuase the module dependency graph is defined by the package name of the source client, not individual module dependency package name. i.e. In-package module dependencies are resolved/loaded only if the parent source compile matches the package name.

Resolves rdar://139979180
2024-11-18 13:29:30 -08:00
Allan Shortlidge
e76bcac17d Frontend: Introduce -disable-upcoming-feature and -disable-experimental-feature.
To allow feature build settings to be composed more flexibly, allow an
`-enable-upcoming-feature` flag to be overridden by a
`-disable-upcoming-feature` flag. Whichever comes last on the command line
takes effect. Provide the same functionality for `-enable-experimental-feature`
as well.

Resolves rdar://126283879.
2024-11-15 18:20:28 -08:00
Doug Gregor
34c020d5f4 Revert "Emit mangled names for public symbols into the .swiftinterface"
This reverts commit 0aff85ced7.
2024-11-12 22:38:47 -08:00
Arnold Schwaighofer
05db4f091e Fix spelling in comment 2024-11-08 15:58:38 -08:00
Arnold Schwaighofer
e07f4d4f85 Disable UseAggressiveReg2MemForCodeSize on WASM
It causes an LLVM WASM backend instruction selection failure.

rdar://139541259
2024-11-08 15:52:23 -08:00
Antonio Frighetto
377c03fa7e [Driver][Frontend] Introduce load-pass-plugin option
Allow dynamic loading of LLVM passes via `load-pass-plugin`
option passed to the Swift compiler driver.
2024-11-07 17:25:24 +01:00
Allan Shortlidge
e49b248bee Frontend: Remove -disable-print-package-name-for-non-package-interface.
It is unsound to expose `package` declarations in textual interfaces without a
package identity for them to belong to so we should not offer this flag.

Resolves rdar://139361524.
2024-11-06 11:16:18 -08:00
Allan Shortlidge
fa5b783e3f Revert https://github.com/swiftlang/swift/pull/76244.
Partially resolves rdar://139236053.
2024-11-05 14:13:39 -08:00
Steven Wu
0a18baa510 Merge pull request #76732 from cachemeifyoucan/eng/PR-136682810
[Macro] Precise macro plugin dependency during scanning
2024-11-04 09:21: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
Rintaro Ishizaki
d4db99ce9d [Parse] Remove unnecessary dependencies to Parser.h
C++ swift::Parser is going to be replaced with SwiftParser+ASTGen.
Direct dependencies to it should be removed. Before that, remove
unnecessary '#include "swift/Parse/Parser.h"' to clarify what actually
depends on 'swift::Parser'.

Split 'swift::parseDeclName()' et al. into the dedicated files.
2024-11-02 01:23:59 -07:00
Allan Shortlidge
2518691944 Merge pull request #77359 from tshortli/downgrade-upcoming-feature-already-enabled
Frontend: Downgrade 'already enabled' to a warning for experimental features
2024-11-01 21:42:19 -07:00
Kavon Farvardin
86601fcbbf Merge pull request #76532 from kavon/samplepgo
Add support for SamplePGO
2024-11-01 17:52:52 -07:00
Allan Shortlidge
2fa75bd0bd Frontend: Downgrade 'already enabled' to a warning for experimental features.
If an upcoming feature was enabled by passing it via `-enable-experimental-feature`,
downgrade the `already enabled` diagnostic to a warning.

Resolves rdar://139087679.
2024-11-01 15:41:05 -07:00
Kavon Farvardin
19e593bc07 PGO: new -debug-info-for-profiling frontend flag
This achieves the same as clang's `-fdebug-info-for-profiling`, which
emits DWARF discriminators to aid in narrowing-down which basic block
corresponds to a particular instruction address. This is particularly
useful for sampling-based profiling.

rdar://135443278
2024-11-01 11:59:54 -07:00
Kavon Farvardin
2b01714fba PGO: new -profile-sample-use= frontend flag
This is meant to match clang's `-fprofile-sample-use=` and accepts a
file with the same format.

rdar://135443278
2024-11-01 11:59:54 -07:00
Steven Wu
47b3efdb6e [Macro] Add a new macro loading option that do not involve searching
Add flag `-load-resolved-plugin` to load macro plugin, which provides a
pre-resolved entry into PluginLoader so the plugins can be loaded based
on module name without searching the file system. The option is mainly
intended to be used by explicitly module build and the flag is supplied
by dependency scanner.
2024-10-31 10:56:21 -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
Tim Kientzle
8144323413 Merge pull request #77036 from tbkka/tbkka-verifiers-are-assertions
Enable full SIL verification with `-compiler-assertions`
2024-10-17 08:23:46 -07:00
Tim Kientzle
c93cd2097c Enable SIL verification in a more-appropriate way 2024-10-16 14:41:50 -07:00
Tim Kientzle
4e91aca623 Enable full SIL verification with -compiler-assertions 2024-10-15 15:46:12 -07:00
Arnold Schwaighofer
8ebb3ec473 IRGen: Add the ability to mark certain generic entry points in back traces
Mark generic function calls with concrete parameters, generic v-table calls and
generic witness table calls where self is generic.
2024-10-14 14:06:10 -07:00
Rintaro Ishizaki
82914d1979 Merge pull request #76986 from rintaro/newparservalidation-on-by-default
[build-script] Enable new parser validation by default
2024-10-14 12:55:46 -07:00
Rintaro Ishizaki
4616c77a33 [Parser] Enable new parser validation only in 'assertions' builds 2024-10-14 09:02:56 -07:00
Nate Chandler
49a2831d3f [CoroutineAccessors] Old ABI may be used via flag.
Add a setting to IRGenOptions and key off of it to emit yield_once_2
coroutines using either (1) the same code-path as yield_once coroutines
or (2) a new, not-yet implemented code-path.

Add flags to set the value in both directions.  During bringup, by
default, use the existing caller-allocated ABI.
2024-10-11 08:25:02 -07:00
Nate Chandler
9e45aa5975 [NFC] Frontend: IRGen arg parsing gets LangOpts.
Among other things, facilitates using features rather than bespoke
flags.
2024-10-10 18:08:27 -07:00
Steven Wu
5fa12d31ae Merge pull request #76738 from cachemeifyoucan/eng/PR-136787368
[CAS] Use IncludeTreeFileList instead of full CASFS for caching
2024-10-08 10:42:24 -07:00
Allan Shortlidge
9e93b7b730 Frontend: Remove support for -experimental-spi-imports flag.
Its functionality has been superseded by `@_spiOnly import`. There are no
longer any known clients and the flag was already unsupported in Swift 6, so
the functionality is now removed (but the flag is only deprecated for Swift 5).

Resolves rdar://136867210.
2024-10-01 17:27:22 -07:00
Steven Wu
cd07d532af [CAS] Use IncludeTreeFileList instead of full CASFS for caching
Use IncludeTreeFileList instead of full feature CASFS for swift
dependency filesystem. This allows smaller CAS based VFS that is smaller
and faster. This is enabled by the CAS enabled compilation does not
need to iterate file system.

rdar://136787368
2024-09-30 16:01:33 -07:00
Doug Gregor
0aff85ced7 Emit mangled names for public symbols into the .swiftinterface
When the frontend option `-abi-comments-in-module-interface` is provided
during interface printing, the printed interface will contain
additional comments that provide the mangled names for public symbols.
This is an experiment in seeing how much information we can
meaningfully extract from a printed Swift interface for the purpose of
bridging with other languages.
2024-09-25 15:49:34 -07:00
Rintaro Ishizaki
c57025af67 Avoid #include AST headers in Basic headers
Resolve a layering violation. `DiagnosticBehavior` was used in
`LangOptions`. Introduce a dedicated 'enum' for the possible values.
2024-09-24 15:18:26 -07:00
Arnold Schwaighofer
b49e30c01b IRGen: Add an option to force emission of an async context pointer on the stack for leaf funclets
`-Xfrontend -enable-async-frame-pointer-all`

rdar://135746607
2024-09-19 12:28:57 -07:00
Ellie Shin
db2a4df6e1 Merge pull request #76450 from swiftlang/elsh/re-revert-pkg-name-pr
Revert "Revert "Do not print package-name in non-package interface by…
2024-09-13 12:53:59 -07:00
Arnold Schwaighofer
8e9cd5db68 Merge pull request #76150 from aschwaighofer/async_entry_ret_metadata
IRGen: Add metadata for async funclets denoting frame entry and frame exists
2024-09-13 11:52:00 -07:00
elsh
60f1ea4f85 Revert "Revert "Do not print package-name in non-package interface by default.""
This reverts commit 4b8e76fbeb.
2024-09-13 08:20:50 -07:00
Kuba (Brecka) Mracek
436e06f7b8 Merge pull request #76394 from kubamracek/embedded-no-textual-imports
[embedded] Disable building from textual interface files in Embedded Swift
2024-09-12 17:17:33 -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
Kuba Mracek
f37ba167a6 [embedded] Disable building from textual interface files in Embedded Swift 2024-09-12 10:40:22 -07:00
Dmitrii Galimzianov
a8b71ea97f Add -print-diagnostic-groups flag
This change adds the `-print-diagnostic-groups` flag as described by SE-0443.
2024-09-11 13:34:42 +02:00
Doug Gregor
08e339b7b4 Merge pull request #74466 from DmT021/wp/no-warning-as-error
[Diagnostics] Add -no-warning-as-error to except a specific warning from being treated as an error
2024-09-09 09:35:05 -07:00
Dmitrii Galimzianov
070c77ebcf fixup! [Diagnostics] Add -[no-]warning-as-error flags for precise control over warning behavior 2024-09-07 07:55:27 +02:00
Dmitrii Galimzianov
28883b6654 [Diagnostics] Add -[no-]warning-as-error flags for precise control over warning behavior
This commit adds new compiler options -no-warning-as-error/-warning-as-error which allows users to specify behavior for exact warnings and warning groups.
2024-09-07 01:14:43 +02:00
Xi Ge
4b8e76fbeb Revert "Do not print package-name in non-package interface by default." 2024-09-05 21:36:32 -07:00
Ellie Shin
d653a01732 Merge pull request #76278 from swiftlang/elsh/pcmo-diags 2024-09-05 20:56:33 -07:00
elsh
66b504a253 [Package CMO] Diagnose missing library-evolution flag.
This PR ensures library-evolution is enabled for Package CMO; without it,
it previously fell back to regular CMO, which caused mismatching serialization
attributes if importing another module that had Package CMO enbaled, causing
an assert fail for loadable types.

Resolves rdar://135308288
2024-09-05 05:55:12 -07:00
elsh
640b1252fc Do not print package-name in non-package interface by default.
Having package-name printed in public or private interface led to strange dependency errors in the past. For example, an SPI module is a dependency within a package, but due to the package-name being printed in public or private interface, dependency scanner tries to find it even for an external client of the package, causing a `no such module found` error. The  -disable-print-package-name-for-non-package flag helps with such case, but to enforce the correct behavior, we should make it a default to not print package-name in public or private interface.

Resolves rdar://135260270
2024-09-04 02:40:19 -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
Arnold Schwaighofer
eaf90dff38 IRGen: Add metadata for async funclets denoting frame entry and frame exists
Adds sections `__TEXT,__swift_as_entry`, and `__TEXT,__swift_as_ret` that
contain relative pointers to async functlets modelling async function entries,
and function returns, respectively.

Emission of the sections can be trigger with the frontend option
`-Xfrontend -enable-async-frame-push-pop-metadata`.

This is done by:

* IRGen adding a `async_entry` function attribute to async functions.
* LLVM's coroutine splitting identifying continuation funclets that
  model the return from an async function call by adding the function
  attribute `async_ret`.  (see #llvm-project/pull/9204)
* An LLVM pass that keys off these two function attribute and emits the
  metadata into the above mention sections.

rdar://134460666
2024-09-03 08:44:16 -07:00