Commit Graph

6583 Commits

Author SHA1 Message Date
Slava Pestov
c321b337ba SIL: Fix crash with missing existential Sendable conformance
If a protocol does not inherit Sendable, we still say that the
existential type is Sendable in Swift 5 mode. Make sure this
doesn't crash the SIL specializer.

Fixes https://github.com/swiftlang/swift/issues/75728
2024-08-08 16:17:16 -04:00
Ben Barham
7bdf1e117e Merge remote-tracking branch 'origin/main' into manually-merge-main-to-rebranch
Conflicts:
  - `lib/PrintAsClang/PrintSwiftToClangCoreScaffold.cpp` not positive
    what the cause here was, just took main.
2024-08-06 13:44:27 -07:00
Erik Eckstein
345f9c1dfc AliasAnalysis: handle destroy_value [dead_end] in computeMemoryEffect
We don't have to take deinit effects into acount for a `destroy_value [dead_end]`.
Such destroys are lowered to no-ops and will not call any deinit.
2024-08-05 17:02:06 +02:00
swift-ci
7ef1bb2252 Merge remote-tracking branch 'origin/main' into rebranch 2024-07-31 15:36:10 -07:00
Alexis Laferrière
f458c56143 Revert one line from "SILBuilder: use the new ASSERT macro in the SILBuilder"
From commit bf3b69bba8.

installedOverride refers to something protected behind an `#ifndef NDEBUG`.

rdar://132930970
2024-07-31 14:53:38 -07:00
swift-ci
4cc51f897a Merge remote-tracking branch 'origin/main' into rebranch 2024-07-31 10:15:18 -07:00
Erik Eckstein
bf3b69bba8 SILBuilder: use the new ASSERT macro in the SILBuilder
It's important to catch assert failures in the SILBuilder also in a release build of the compiler
2024-07-31 15:31:03 +02:00
swift-ci
74c720b622 Merge remote-tracking branch 'origin/main' into rebranch 2024-07-29 22:34:22 -07:00
Erik Eckstein
031f23547a SILType: remove the now obsolete aggregateContainsRecord function 2024-07-29 17:33:46 +02:00
Erik Eckstein
084d60d7b7 Swift SIL: add some APIs to instructions and other small improvments 2024-07-29 17:33:44 +02:00
Erik Eckstein
4c49e0039b Verifier: in the swift verifier call the bridged C++ verificationFailure function in case of a failure
This brings all the nice verifier features to the swift verifier, like printing the surrounding instructions in case of a failure, etc.
2024-07-29 17:33:43 +02:00
Erik Eckstein
95bd329b1f Swift SIL: bridge the hasPointerEscape flags of MoveValueInst and BeginBorrowInst 2024-07-29 17:33:43 +02:00
Erik Eckstein
04e0907ab0 SIL: rename Type.instanceTypeOfMetatype -> Type.loweredInstanceTypeOfMetatype
The same for SILType

It needs to be made clear that this is not the "original", but the lowered SIL type.

NFC
2024-07-29 17:33:36 +02:00
swift-ci
2f07d52ed2 Merge remote-tracking branch 'origin/main' into rebranch 2024-07-26 20:35:41 -07:00
Andrew Trick
25825e25ee SwiftCompilerSources: use Type.isVoid instead of Type.isEmpty. 2024-07-26 17:32:23 -07:00
swift-ci
8f7c33c6a1 Merge remote-tracking branch 'origin/main' into rebranch 2024-07-26 16:33:56 -07:00
Andrew Trick
3316a58ba7 Allow move_value of trivial values.
Required for SIL level local variable scopes.
2024-07-26 08:27:31 -07:00
Andrew Trick
075d3a42c1 Add SILValue::isFromVarDecl utility. 2024-07-26 08:27:31 -07:00
swift-ci
3419f76e4f Merge remote-tracking branch 'origin/main' into rebranch 2024-07-26 01:33:19 -07:00
Konrad `ktoso` Malawski
eb675c222e [Distributed] Correct tbd handling for distributed thunks (#74935) 2024-07-26 16:52:18 +09:00
swift-ci
6c22b2307d Merge remote-tracking branch 'origin/main' into rebranch 2024-07-25 19:43:11 -07:00
Nate Chandler
549b4a8bd9 [Test] Tweaked comment. 2024-07-25 13:52:21 -07:00
swift-ci
d33355dca4 Merge remote-tracking branch 'origin/main' into rebranch 2024-07-24 08:54:01 -07:00
Erik Eckstein
b739c6263b WalkUtils: handle unsafe_ref_cast which casts between AnyObject and a class
We need to ignore such casts because otherwise the constructed walking path wouldn't contain the right `existential` field kind.
Fixes a miscompile caused by redundant load elimination.

rdar://132364917
2024-07-24 11:35:08 +02:00
swift-ci
7203e893f7 Merge remote-tracking branch 'origin/main' into rebranch 2024-07-23 21:14:07 -07:00
Nate Chandler
812891cf81 [NFC] PrunedLiveness: Clarified boundary API.
When checking whether an instruction is contained in a liveness
boundary, a pointer to a DeadEndBlocks instance must always be passed.
When the pointer is null, it is only checked that the instruction occurs
within the direct live region.  When the pointer is non-null, it is
checked whether the instruction occurs within the region obtained by
extending the live region up to the availability boundary within
dead-end regions that are adjacent to the non-lifetime-ending portion of
the liveness boundary.
2024-07-23 13:38:35 -07:00
swift-ci
80f3a32db1 Merge remote-tracking branch 'origin/main' into rebranch 2024-07-23 13:13:20 -07:00
Nate Chandler
e0da318129 [PrunedLiveness] Fix extended boundary check.
The areUsesWithinBoundary/areUsesOutsideBoundary methods take the
dead-ends because the region that they're checking for containment
within contains more than just (is a (non-strict) superset of) the
pruned live region.  On the other hand, the region also contains _less_
than (is a (non-strict) subset of) the available region.  Instructions
are in this extended region only if they're in a dead-end block which is
forwards reachable from the non-lifetime-ending liveness boundary.
2024-07-22 21:51:34 -07:00
swift-ci
0b785e57a7 Merge remote-tracking branch 'origin/main' into rebranch 2024-07-19 02:34:28 -07:00
Michael Gottesman
ae797d43e9 [region-isolation] Propagate through the whole source operand instead of just the representative of the source value when constructing assign and merge.
This will let me know the exact source operand used instead of the source value
representative. This will ensure that the name associated with the diagnostic is
not of the representative value, but the actual value that was the source of the
assign.

This is an NFCI commit that is an algebraic refactor.
2024-07-18 21:28:22 -07:00
Mykola Pokhylets
816d62c972 Merge remote-tracking branch 'upstream/main' into mpokhylets/isolated-deinit
# Conflicts:
#	include/swift/Basic/Features.def
#	lib/SILGen/SILGenDestructor.cpp
#	test/Concurrency/flow_isolation.swift
#	test/abi/macOS/arm64/concurrency.swift
#	test/abi/macOS/x86_64/concurrency.swift
2024-07-11 13:11:59 +02:00
Mykola Pokhylets
28a06feaad Added isolated deallocator to TBDGen 2024-07-11 13:09:06 +02:00
Mykola Pokhylets
b189495518 Introduced isolated deinit as a SIL entity 2024-07-11 13:09:05 +02:00
swift-ci
a32c1896dc Merge remote-tracking branch 'origin/main' into rebranch 2024-07-10 23:09:47 -07:00
Andrew Trick
12acde2215 Merge pull request #75096 from meg-gupta/lifetimedeparg
Add support for lifetime dependence in parameter position
2024-07-10 22:56:23 -07:00
Ben Barham
2715d0e9d6 Merge branch 'main' into 20240710-main-to-rebranch
Conflicts:
  - `test/Interop/Cxx/class/method/methods-this-and-indirect-return-irgen-itanium.swift`
    previously fixed on rebranch, now fixed on main (slightly differently).
2024-07-10 20:42:09 -07:00
Meghana Gupta
154989463b Add support for lifetime dependence in parameter position 2024-07-10 14:20:03 -07:00
Meghana Gupta
06faf98251 Update Array bounds check optimization's isIdentifiedUnderlyingArrayObject 2024-07-10 03:32:27 -07:00
swift-ci
b7921a8232 Merge remote-tracking branch 'origin/main' into rebranch 2024-07-06 14:34:09 -07:00
Slava Pestov
86d567f95a AST: ModuleDecl::lookupConformance() is a static method 2024-07-06 12:05:47 -04:00
Slava Pestov
fae01d9776 AST: Remove ModuleDecl parameter from more places 2024-07-06 12:05:46 -04:00
swift-ci
b3654c2cac Merge remote-tracking branch 'origin/main' into rebranch 2024-07-05 20:55:36 -07:00
Andrew Trick
32ca35cb64 Fix SILBridging for GlobalAddr_getDecl
and RefElementAddr_getDecl.

Fixes:
Assertion failed: (isa<To>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file Casting.h

While running pass #224 SILFunctionTransform "LifetimeDependenceDiagnostics"
 #7 0x0000000102d3efcc decltype(auto) llvm::cast<swift::DebugValueInst, swift::SILInstruction>(swift::SILInstruction*)
 #8 0x0000000102d01e24 swift::DebugValueInst* BridgedInstruction::getAs<swift::DebugValueInst>() const
 #9 0x0000000102d01ee4 BridgedInstruction::GlobalAddr_getDecl() const
2024-07-05 12:00:07 -07:00
swift-ci
d33023fcdb Merge remote-tracking branch 'origin/main' into rebranch 2024-07-04 00:36:46 -07:00
Nate Chandler
dd730b849c [LifetimeCompletion] Flag instructions dead_end. 2024-07-03 16:44:35 -07:00
Nate Chandler
d641dc65bf [UnreachableLifetimeCompletion] Keep ctor arg.
Don't drop the argument, use it to initialize the member.
2024-07-03 15:27:00 -07:00
Nate Chandler
365c1a0286 [Test] Provide dead-end blocks to SIL tests.
Via a new method on the dependencies struct.
2024-07-03 15:27:00 -07:00
Nate Chandler
b150a484f2 [SIL] Add dead_end flag to dealloc_box. 2024-07-03 15:26:59 -07:00
Nate Chandler
a8cc3bfdda [SIL] Add dead_end flag to destroy_value. 2024-07-03 15:26:59 -07:00
Nate Chandler
91fe12aab4 [NFC] SIL: Typed debug_value.poisonRefs. 2024-07-03 14:53:30 -07:00