Commit Graph

318 Commits

Author SHA1 Message Date
Ian Anderson
69fa949c01 [Triple] Support the new target triple "os" for firmware
Add support for the new Firmware llvm::Triple::OSType, and make a swift::DarwinPlatformKind to go with it.

rdar://165361368
2026-02-03 13:02:44 -08:00
Xi Ge
383407ce8a Merge pull request #86857 from sepy97/ignore-spi-group-new-api
ABIChecker: add -ignore-spi-group-new-api flag
2026-01-28 21:10:30 -08:00
Sam Pyankov
a6697422e3 ABIChecker: add -ignore-spi-group-new-api flag
Add a new -ignore-spi-group-new-api flag that selectively suppresses
"new API without '@available'" diagnostics for specified SPI groups
while still reporting ABI-breaking changes.

rdar://167702700
2026-01-28 15:30:29 -08:00
Erik Eckstein
8158b95a5a Remove the now unused -enable-ossa-complete-lifetimes and -disable-ossa-complete-lifetimes frontend options 2026-01-22 17:41:48 +01:00
Erik Eckstein
18063707b5 Optimizer: enable complete OSSA lifetimes throughout the pass pipeline
This new OSSA invariant simplifies many optimizations because they don't have to take care of the corner case of incomplete lifetimes in dead-end blocks.

The implementation basically consists of these changes:
* add the lifetime completion utility
* add a flag in SILFunction which tells optimization that they need to run the lifetime completion utility
* let all optimizations complete lifetimes if necessary
* enable the ownership verifier to check complete lifetimes
2026-01-22 17:41:48 +01:00
Fabrice de Gans
b47e0320d9 Adjust dependencies on LLVM components
Swift host libraries should depend on LLVM libraries as part of the
`LLVM_LINK_COMPONENTS` argument so the dependency graph can be properly
set up. This is a problem when building LLVM as a DLL on Windows as
Swift targets should depend on the LLVM DLL.

Bug: #85241
2026-01-15 17:57:41 +01:00
Ian Anderson
48ab4b0595 [Frontend][Darwin] Use the system prefix from SDK when constructing the default search paths
Some Darwin platforms like DriverKit use a system prefix on all of their search paths. Even though DriverKit isn't supported, add support to get the system prefix from SDKSettings when constructing the default search paths.

This requires the DarwinSDKInfo to be gotten earlier in CompilerInvocation, pass that down to ASTContext through CompilerInstance.

-platform-availability-inheritance-map-path is no longer needed to support visionOS in tests, remove that and its supporting code that gets an alternative DarwinSDKInfo.

rdar://166277280
2026-01-09 12:41:32 -08:00
Hiroshi Yamauchi
a3e5f0bcef Set up the AST-affecting ClangImporter CodeGenOpts options early (#86175)
This is to keep clang module cache hashes consistent throughout the
build and avoid inconsistent hash errors due to the CodeGenOpts
changing at the IRGen phase in the middle of a build.

https://github.com/swiftlang/swift/issues/86116
2026-01-09 10:38:46 -08:00
Owen Voorhees
24d4d200a4 API digester support for Xcc options 2025-12-16 14:51:18 -08:00
Saleem Abdulrasool
58035835d2 Merge pull request #85899 from compnerd/filename
DriverTool: adjust `argv[0]` scanning for CAS
2025-12-09 18:13:01 -08:00
finagolfin
6d4931986f [autolink-extract] Update deduplication list for Observation (#85856)
All linux and Android CI show this being repeated many times, eg when
[building the Docc binary on the linux
CI](https://ci.swift.org/job/swift-PR-Linux-smoke-test/24247/consoleText):
```
"/home/build-user/build/buildbot_linux/unified-swiftpm-build-linux-x86_64/x86_64-unknown-linux-gnu/release/docc.build/main.swift.o" "-lswiftObservation" ... repeated many times ... "-lswiftObservation" "-lswiftCore"
```
2025-12-09 19:46:07 +05:30
Saleem Abdulrasool
070916fef3 DriverTool: adjust argv[0] scanning for CAS
Ensure that we nativize the path and consider only the filename starting
prefix to account for file suffixes (e.g. `.exe` on Windows). This
ensures that we properly support other platforms.
2025-12-08 08:53:26 -06:00
Anthony Latsis
88220a33c3 [NFC] "SwiftVersion" → "LanguageMode" in DiagnosticEngine::warnUntilSwiftVersion, etc. 2025-12-04 15:11:07 +00:00
Steven Wu
b56f541732 Merge pull request #85499 from cachemeifyoucan/eng/PR-164409895
[Caching] Fix multi-threaded WMO with MCCAS
2025-11-18 09:22:13 -08:00
Yuta Saito
8748213d52 Merge pull request #85524 from kateinoigakukun/yt/fix-non-reg2mem-rle-crash 2025-11-16 23:10:20 +09:00
Yuta Saito
32aa4d9aed sil-opt: Add flag to disable aggressive reg2mem mode 2025-11-15 12:12:46 +00:00
Steven Wu
b1d669bea1 [Caching] Fix multi-threaded WMO with MCCAS
MCCAS wasn't setup correctly when using parallel WMO. Make sure the
CAS ObjectStore and ResultCallbacks are passed to LLVM backend when
using parallel WMO.

rdar://164409895
2025-11-13 12:20:31 -08:00
Ian Anderson
5cdf2a879a [ABIChecker] Remove -iframework from swift-api-digester
-iframework is a holdover from when swift-api-digester was an LLVM tool. Now that everything has switched over to -Fsystem, -iframework can be removed.

rdar://153665579
2025-11-12 16:37:49 -08:00
Dylan Sturgeon
4b4f9f18fc Add an option for symbol graph to support long module names. (#83782)
Currently symbol graphs are always written in files that contain 1 to 2
module names. It's possible for Swift module names to be very long, so
combining 2 of them in file name like `module1@module2...` in the same
path component means the name can be too long for some file systems. The
new option `-symbol-graph-shorten-output-names` changes the symbol graph
output files to use a MD5 hash of the module name(s) as the filename and
outputs an additional JSON file with the original names mapped to the
real filename. The module names JSON can be used to construct a VFS
overlay with the original naming scheme.

fix #83723

I considered using vfsoverlay, which seems like a viable solution, but
the vfsoverlay options don't seem to apply to any of the outputs from
the compiler. When I set an overlay to remap the symbol graph file
outputs, the remapped external paths aren't used so the root problem of
too long file names remains.
2025-11-06 19:30:44 -08:00
Erik Eckstein
65e4c10113 Optimizer: remove the obsolete SpeculativeDevirtualization pass
This pass has been disabled since a very long time (because it's terrible for code size).
It does not work for OSSA. Therefore it cannot be enabled anymore (as is) once we have OSSA throughout the pipeline.
So it's time to completely remove it.
2025-10-13 10:49:17 +02:00
Yuta Saito
cd1db4a575 [autolink-extract] Update deduplication list for new Foundation, Testing, and WASI platform
We now have several new runtime libraries in the toolchain but they are
not listed in the autolink deduplication list. This can lead to an excessive
memory footprint when linking on platforms that use autolink-extract.

See https://github.com/swiftlang/swift/issues/58380
2025-10-09 06:57:48 +00:00
Michael Gottesman
e4fb8819d2 Merge pull request #84622 from gottesmm/pr-7065a633780e3a54b56563650e321ec0801bcb45
[sil-llvm-gen] Run Sema before we attempt to emit IR.
2025-10-07 00:57:05 -07:00
Michael Gottesman
3a96e99bd8 [sil-llvm-gen] Run Sema before we attempt to emit IR. 2025-10-06 15:17:26 -07:00
Mishal Shah
03a599c5be Merge pull request #84606 from swiftlang/rebranch
Merge clang 21.x rebranch into main
2025-10-02 20:17:05 -07:00
Michael Gottesman
d0d2163e0d [sil-llvm-gen] Allow for -Xllvm options to be passed to sil-llvm-gen.
Specifically, we ignore the -Xllvm bit and put the option into
FrontendOptions.LLVMArgs so that parts of CompilerInvocation that assumes that
-Xllvm flags will be placed there are actually there. We still pass through the
argument to llvm::cl so it gets set that way as well.
2025-10-01 09:26:57 -07:00
swift-ci
096394b77e Merge remote-tracking branch 'origin/main' into rebranch 2025-09-29 18:35:20 -07:00
Michael Gottesman
8c9f291f8b Merge pull request #84554 from gottesmm/pr-cd8090d1fb5e8fd9fbb2ae8dbdd5eb34dc24df99
[sil-llvm-gen] Add support for emitting IR before LLVM optimizations run
2025-09-29 18:32:31 -07:00
Michael Gottesman
ca2fb094d2 [sil-llvm-gen] Update some settings setup from sil-opt. 2025-09-29 12:58:18 -07:00
swift-ci
b2a0c63a95 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-27 18:14:12 -07:00
Michael Gottesman
52a163fa5e Merge pull request #84555 from gottesmm/pr-4f37ab5228b75850c247af4f8dd913996a0390bd
[irgen] Make HasAArch64TBI an IRGen option instead of a LangOpts.
2025-09-27 18:09:12 -07:00
Michael Gottesman
361e63c815 [irgen] Make HasAArch64TBI an IRGen option instead of a LangOpts.
With some changes that I am making, we will no longer need this flag at the SIL
level, so we can just make it an IRGen flag (which it really should have been
in the first place).
2025-09-27 14:44:36 -05:00
Michael Gottesman
5c8a95f27a [sil-llvm-gen] Add support for emitting IR before LLVM optimizations run.
Specifically, I renamed the old llvm-as which printed with optimization as
llvm-as-opt and made llvm-as just test IRGen. That is really the true reason
that I created this utility many years ago: to test how IRGen lowers specific
SIL instruction sequences. How LLVM optimizes such sequences once lowered is a
different problem. I updated the one test that used sil-llvm-gen and required
optimizations to use llvm-as-opt so that the tests output did not change.
2025-09-27 14:42:04 -05:00
swift-ci
d5a03fa0e4 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-26 22:36:42 -07:00
Erik Eckstein
a322fd9209 Serialization: remove the IS_OSSA flag from the module file header 2025-09-26 08:01:08 +02:00
Erik Eckstein
2f124cf564 Remove the -enable-ossa-modules option.
OSSA modules are enabled by default.
The compiler still accepts this option but it has no effect.
2025-09-26 08:01:08 +02:00
swift-ci
e35756ef85 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-23 15:38:03 -07:00
Doug Gregor
0737723c5c Merge pull request #84465 from DougGregor/has-feature-library-evolution
Add an optional language feature for Library Evolution
2025-09-23 15:18:48 -07:00
Doug Gregor
c68ef1cf71 Add an optional language feature for Library Evolution
Replace the one-off compiler flag for Library Evolution with an
optional language feature. This makes the
`hasFeature(LibraryEvolution)` check work in an `#if`, and is
otherwise just cleanup.

Tracked by rdar://161125572.
2025-09-22 17:45:34 -07:00
swift-ci
2deb2f9a87 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-19 22:17:53 -07:00
Kavon Farvardin
889baf7f2c Merge pull request #84411 from kavon/copyprop-onone
sil: provide ability to run CopyPropagation in -Onone
2025-09-19 22:09:59 -07:00
Kavon Farvardin
4a943d464d sil: provide ability to run CopyPropagation in -Onone
This does not enable it by default. Use either of the flags:

```
-enable-copy-propagation
-enable-copy-propagation=always
```

to enable it in -Onone. The previous frontend flag
`-enable-copy-propagation=true` has been renamed to
`-enable-copy-propagation=optimizing`, which is currently default.

rdar://107610971
2025-09-19 16:23:19 -07:00
swift-ci
3a31109821 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-19 10:35:08 -07:00
Anthony Latsis
ea5d89d0d0 tools: Set Swift bug report message in some executable targets
If these programs crash, we want them to print the Swift bug report
message, not the default LLVM one, which leads to
https://github.com/llvm/llvm-project/issues.

While here, hoist the setting of the bug report message to the
START_PROGRAM macro so that we don't forget to set it in the future.
2025-09-19 12:05:31 +01:00
swift-ci
94f8b0d0e3 Merge remote-tracking branch 'origin/main' into rebranch 2025-08-25 17:03:36 -07:00
Michael Gottesman
bfecaa357f [frontend] Expose via a LangOption whether or not the compiler is compiling for a triple that supports AArch64 TBI.
Just breaking down layers of a larger patch to make it easier to review.
2025-08-21 12:52:49 -07:00
Anthony Latsis
3f841b515c Merge remote-tracking branch 'origin/main' into jepa-rebranch 2025-07-30 14:31:33 +01:00
Allan Shortlidge
e8ced33b81 swift-symbolgraph-extract: Infer target triple.
Infer the `-target` argument to `swift-synthesize-interface` to be the host
triple when unspecified instead of emitting an error.
2025-07-28 12:43:37 -07:00
Allan Shortlidge
3ffb218e9a swift-synthesize-interface: Infer target triple.
Infer the `-target` argument to `swift-synthesize-interface` to be the host
triple when unspecified instead of emitting an error.

Resolves rdar://156353450.
2025-07-28 12:42:57 -07:00
Anthony Latsis
b66a1aa8c5 DriverTool,IRGen: Address llvm::Target::createTargetMachine overload deprecation
See https://github.com/llvm/llvm-project/pull/130940.
2025-07-21 12:47:48 +01:00
swift-ci
f7bc202e92 Merge remote-tracking branch 'origin/main' into rebranch 2025-07-10 21:35:02 -07:00