Commit Graph

46165 Commits

Author SHA1 Message Date
Erik Eckstein
b256bab988 fix BridgedPassContext::addFunctionToPassManagerWorklist
A new function must not be added to the pass-manager's worklist if done from a module pass.
2025-06-20 08:15:03 +02:00
Erik Eckstein
fc8f264d56 SIL: add some instruction APIs
* some APIs for `MarkUnresolvedNonCopyableValueInst`
* `AllocBoxInst.hasDynamicLifetime`
2025-06-20 08:15:03 +02:00
Erik Eckstein
2259fe6972 SIL: add some instruction creation functions in Builder 2025-06-20 08:15:03 +02:00
Erik Eckstein
c19aa69940 SIL: implement Function.isSerialized and Function.isAnySerialized with serializedKind
No need for bridging functions
2025-06-20 08:15:02 +02:00
Erik Eckstein
c70298220d SIL: fix debug locations for various kind of instructions
There are some restrictions for which kind of locations can be on which kind of instructions.
This change implements them correctly.
2025-06-20 08:15:02 +02:00
Erik Eckstein
c482b09878 SIL: let Builder.createAllocStack specify a debugVariable 2025-06-20 08:15:02 +02:00
Erik Eckstein
28dd6f7064 Optimizer: improve the SpecializationCloner
* add `cloneFunctionBody` without an `entryBlockArguments` argument
* remove the `swift::ClosureSpecializationCloner` from the bridging code and replace it with a more general `SpecializationCloner`
2025-06-20 08:15:02 +02:00
Erik Eckstein
9bd85c6723 SIL: add some Function APIs
* `isReferencedInModule`
* `shouldOptimize`
2025-06-20 08:15:01 +02:00
Erik Eckstein
d8e4e501f6 Optimizer: add some SIL modification APIs to Context
* `insertFunctionArgument`
* `BeginAccessInst.set(accessKind:)`
* `erase(function:)`
2025-06-20 08:15:01 +02:00
Erik Eckstein
de28cf04cc Optimizer: add Context. mangle(withBoxToStackPromotedArguments) 2025-06-20 08:15:01 +02:00
Erik Eckstein
bc7024edfe Optimizer: fix ModulePassContext.mangle(withDeadArguments:)
If mangled the wrong argument indices.
2025-06-20 08:15:00 +02:00
Erik Eckstein
63cb683cb7 SIL: improve some Location APIs
* rename `var autoGenerated` -> `var asAutoGenerated`
* add `var asCleanup`
* add `func withScope`
2025-06-20 08:15:00 +02:00
Erik Eckstein
4212c611e5 Optimizer: add Context.createSpecializedFunctionDeclaration
Originally this was a "private" utility for the ClosureSpecialization pass.
Now, make it a general utility which can be used for all kind of function specializations.
2025-06-20 08:15:00 +02:00
Erik Eckstein
1f304e5609 SIL: improve APIs for Box types
* move `isBox` from `SIL.Type` to `TypeProperties` to make it also available for AST types
* add `BoxFieldsArray.isMutable(fieldIndex:)`
2025-06-20 08:14:59 +02:00
Erik Eckstein
d025e9f7a5 SIL: add var Argument.decl: ValueDecl? 2025-06-20 08:14:58 +02:00
Michael Buch
14c3d8dca5 Merge pull request #82335 from charles-zablit/charles-zablit/demangling/move-NodePrinter
[swift][Demangling][NFC] Move NodePrinter declarations to a header
2025-06-19 22:38:38 +01:00
Anthony Latsis
30a8b59c6e ASTBridging: Bridge swift::TypeAttrKind directly 2025-06-19 18:11:40 +01:00
Anthony Latsis
8501c8776e ASTBridging: Bridge swift::ExternKind directly 2025-06-19 18:11:40 +01:00
Anthony Latsis
0b0ebfc9fb ASTBridging: Bridge swift::ExposureKind directly 2025-06-19 18:11:40 +01:00
Anthony Latsis
b2b79f3ad7 ASTBridging: Bridge swift::InlineKind directly 2025-06-19 18:11:40 +01:00
Anthony Latsis
6527be558a ASTBridging: Bridge swift::NonIsolatedModifier directly 2025-06-19 18:11:40 +01:00
Anthony Latsis
29ef3e300f ASTBridging: Bridge swift::InheritActorContextModifier directly 2025-06-19 18:11:40 +01:00
Anthony Latsis
68bb4b33f9 ASTBridging: Bridge swift::EffectsKind directly 2025-06-19 18:11:40 +01:00
Anthony Latsis
12de029d97 ASTBridging: Bridge swift::AccessLevel directly 2025-06-19 18:11:40 +01:00
Anthony Latsis
cf09773d66 ASTBridging: Bridge swift::Associativity directly 2025-06-19 18:11:40 +01:00
Anthony Latsis
38360fe625 ASTBridging: Bridge swift::DeclAttrKind directly 2025-06-19 18:11:39 +01:00
Anthony Latsis
7de8827169 BasicBridging: Turn BridgedOptional into a macro 2025-06-19 18:11:38 +01:00
Anthony Latsis
722bc0f086 ASTBridging: Bridge swift::DiagID directly 2025-06-19 12:29:27 +01:00
John McCall
a2ded3606e Merge pull request #82327 from rjmccall/non-recursive-print-options
Introduce non-recursive print options and use them to handle IUO printing more elegantly
2025-06-19 18:40:03 +09:00
John Hui
a0d3ad7bd0 Merge pull request #82006 from j-hui/jump-to-def-for-macro-expanded-clang-imports
[SourceKit] Support location info for macro-expanded Clang imports
2025-06-19 02:01:40 -07:00
Ian Anderson
cb954b98f9 [ABIChecker] Use -Isystem and -Fsystem for swift-api-digester
Use the Swift -Fsystem flag for swift-api-digester instead of the clang -iframework flag. Add support for -Isystem for parity.

rdar://152747420
2025-06-18 21:21:45 -07:00
Anthony Latsis
3e9923f0c0 ASTBridging: Bridge swift::AccessorKind directly 2025-06-19 04:26:52 +01:00
Slava Pestov
5987bbf966 Merge pull request #82321 from slavapestov/rqm-fixes
RequirementMachine: Add more limits to catch runaway computation, and fix a bug
2025-06-18 23:00:38 -04:00
michael-yuji
cf2f7154a5 Merge pull request #77836 from michael-yuji/mchiu/freebsd
[FreeBSD] Adding FreeBSD support
2025-06-18 19:59:48 -07:00
Jamie
1f3f830fc7 [SILOptimizer]: slow OSSA lifetime canonicalization mitigation
OSSA lifetime canonicalization can take a very long time in certain
cases in which there are large basic blocks. to mitigate this, add logic
to skip walking the liveness boundary for extending liveness to dead
ends when there aren't any dead ends in the function.

Updates `DeadEndBlocks` with a new `isEmpty` method and cache to
determine if there are any dead-end blocks in a given function.
2025-06-18 17:52:14 -05:00
Artem Chikin
5eb85acad5 Merge pull request #82031 from artemcm/RemovePlaceholdersInDepScanner
[Dependency Scanning] Remove obsolete placeholder module concept
2025-06-18 12:40:30 -07:00
Adrian Prantl
9381a54c67 [RemoteInspection] Change RemoteAbsolutePointer (NFC)
This patch changes RemoteAbsolutePointer to store both the symbol and
the resolved address. This allows us to retire some ugly workarounds
to deal with non-symbolic addresses and it fixes code paths that would
need these workarounds, but haven't implemented them yet (i.e., the
pack shape handling in the symbolicReferenceResolver in MetadatyaReader.

Addresses parts of rdar://146273066.
rdar://153687085
2025-06-18 10:25:15 -07:00
Adrian Prantl
edc7109989 Merge pull request #82244 from adrian-prantl/expected-lowering
[Reflection] Add lightweight error handling to ReflectionContext
2025-06-18 10:08:43 -07:00
Charles Zablit
fdde2a395d move NodePrinter declarations to a header 2025-06-18 12:21:59 +01:00
John McCall
5c20b19296 Introduce non-recursive print options and use them to handle IUO
printing more elegantly.

NFC intended.
2025-06-18 11:47:36 +09:00
Stephen Canon
09dc0920e7 Add a feature check for extern c support of builtin vectors (#82306)
We want to be able to adopt
(https://github.com/swiftlang/swift/pull/82225) in the stdlib without
breaking people building at desk with older toolchains, so let's add a
feature flag.
2025-06-17 19:50:16 -04:00
Slava Pestov
7f8175b3da RequirementMachine: Add two more completion termination checks for concrete type requirements
The concrete nesting limit, which defaults to 30, catches
things like A == G<A>. However, with something like
A == (A, A), you end up with an exponential problem size
before you hit the limit.

Add two new limits.

The first is the total size of the concrete type, counting
all leaves, which defaults to 4000. It can be set with the
-requirement-machine-max-concrete-size= frontend flag.

The second avoids an assertion in addTypeDifference() which
can be hit if a certain counter overflows before any other
limit is breached. This also defaults to 4000 and can be set
with the -requirement-machine-max-type-differences= frontend flag.
2025-06-17 17:51:25 -04:00
Pavel Yaskevich
fc573b6612 [ConstraintSystem] Guard all the performance hacks with a flag
Package the flag into `performanceHacksEnabled()` method on
`ConstraintSystem` and start using it to wrap all of the hacks
in constraint generator and the solver.
2025-06-17 13:53:05 -07:00
Pavel Yaskevich
833b6b19e9 [Frontend] Remove -disable-solver-shrink option
It's folded into a more general "disable performance hacks" one.
2025-06-17 13:52:28 -07:00
(null)
aaf283258b Merge branch 'main' into mchiu/freebsd 2025-06-17 15:41:57 -04:00
(null)
d6811260a9 Merge commit '665515c781999a81094bbe4f8302a7cb1a6a6b39' into mchiu/freebsd 2025-06-17 15:12:23 -04:00
Slava Pestov
a4bfa3f72b Merge pull request #82275 from slavapestov/more-fuzzer-fixes-2
More fuzzer fixes
2025-06-17 14:57:38 -04:00
Artem Chikin
66b8f35a5e Merge pull request #81569 from artemcm/NoBatchForYou
[Legacy Driver] Obsolete and remove batch compilation mode from the legacy driver
2025-06-17 10:49:16 -07:00
Adrian Prantl
868c9912aa [Reflection] Add lightweight error handling to ReflectionContext
Reflection metadata lookup failures are notoriously difficult to debug
because there is no error handling in TypeLowering outside of
compile-time #ifdef'd fprintf(stderr) calls. The nicest thing to do
would be to adopt llvm::Expected<> but TypeLowering is also included
in the standard library, which only has access to a tiny subset of the
LLVM Support library. This patch adds a place to store a pointer to
the first encountered error, which can then be converted to an
llvm::Error at the API level.
2025-06-17 09:47:11 -07:00
Gábor Horváth
304d558f43 Merge pull request #82203 from swiftlang/gaborh/shared-references-are-safe
[cxx-interop] Shared references are considered safe
2025-06-17 16:12:59 +01:00