Commit Graph

11224 Commits

Author SHA1 Message Date
swift-ci
6bbdf7dac2 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-22 12:14:27 -07:00
Kuba (Brecka) Mracek
3ab2314e8c Merge pull request #77154 from kubamracek/embedded-onone
[GenericCloner] Propagate @_optimize(none) when cloning
2024-10-22 12:06:53 -07:00
Andrew Trick
fc9d0b3340 [MoveOnlyAddrChecker] fix VariableNameInferrer for mark_depends
Fix the use-def address walk to pass through mark_dependence to find a variable
introducer with a debug_value use.
2024-10-22 09:28:54 -07:00
Andrew Trick
17a3b8a8a3 [MoveAddrChecker] load from borrowed value looks through mark_depend
Required to add dependencies to unsafe addressors.
2024-10-22 09:27:02 -07:00
Andrew Trick
bdcc4099c7 [MoveObjectChecker] same-inst checking for mark_depends
Extends checkForSameInstMultipleUseErrors to ignore irrelevant unowned uses,
including the mark_dependence base operand, which is currently considered a
pointer escape.
2024-10-22 09:27:02 -07:00
Andrew Trick
508e6760ec [MoveObjectChecker] handle mark_depends
MoveOnlyBorrowsToDestructure: fix gatherBorrows to ignore mark_dependence base
operand uses.
2024-10-22 09:27:02 -07:00
Erik Eckstein
b8026d74e6 Revert "Revert "Optimizer: improve the load-copy-to-borrow optimization and implement it in swift""
This reverts commit 0666c446ec.
2024-10-22 08:40:18 +02:00
swift-ci
7a23cece8d Merge remote-tracking branch 'origin/main' into rebranch 2024-10-21 17:16:48 -07:00
Kuba Mracek
84b69f0c56 [GenericCloner] Propagate @_optimize(none) when cloning 2024-10-21 16:47:19 -07:00
Nate Chandler
9c887a1ab1 [MoveAddrChecker] Init'd looks thru mark_depend.
Extend the hack to determine whether an address begins initialized to
look through mark_dependence instructions.
2024-10-21 09:50:02 -07:00
Nate Chandler
0b47442068 [NFC] MoveAddrChecker: Extract reused expression.
To enable changing its definition.
2024-10-21 09:49:59 -07:00
Nate Chandler
062d063764 [NFC] MoveAddrChecker: Extracted function.
While the FIXME to derive whether an address begins initialized requires
auditing all sites where the instruction is emitted to begin with,
making this a predicate that depends only on the instruction can be done
now.
2024-10-21 09:49:38 -07:00
swift-ci
138625f758 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-18 10:41:34 -07:00
elsh
056d4474ad Revert "Merge pull request #76832 from swiftlang/elsh/pcmo-refactor"
This reverts commit 6b5df5225c, reversing
changes made to b5e3f42cad.
2024-10-18 09:57:43 -07:00
swift-ci
b13deba7f0 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-18 08:44:07 -07:00
Erik Eckstein
0666c446ec Revert "Optimizer: improve the load-copy-to-borrow optimization and implement it in swift"
This reverts commit eed8645610.
2024-10-18 10:36:06 +02:00
swift-ci
5bfc87531f Merge remote-tracking branch 'origin/main' into rebranch 2024-10-17 18:21:11 -07:00
Michael Gottesman
0e0665bfbd [concurrency] Add support for HopToMainActorIfNeededThunk.
It is behind the experimental flag GenerateForceToMainActorThunks.
2024-10-17 13:31:39 -07:00
Michael Gottesman
f0f5ad54fd [thunk-lowering] Add support for mangling identity thunks.
This is just again using identity thunks to show that the behavior works before
I add in hop to main actor.
2024-10-17 11:17:38 -07:00
swift-ci
594a7d7782 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-17 10:21:12 -07:00
Meghana Gupta
a49d8ff1a3 Merge pull request #77061 from meg-gupta/dcecast
DCE unconditional_checked_cast
2024-10-17 10:15:23 -07:00
swift-ci
70ece60b69 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-17 10:11:01 -07:00
Meghana Gupta
5d4e1d000b Merge pull request #77058 from meg-gupta/fixreleasehoisting
Update swift::canUseObject for unconditional_checked_cast
2024-10-17 09:55:33 -07:00
Meghana Gupta
359f6d14bf DCE unconditional_checked_cast 2024-10-16 16:55:22 -07:00
Meghana Gupta
4ab0a891b4 Update swift::canUseObject for unconditional_checked_cast
unconditional_checked_cast can read the pointer, update swift::canUseObject to return false for this.

Previously, if unconditional_checked_cast was dead, we could get a miscompile because of release hoisting.

Fixes rdar://137990246
2024-10-16 16:26:49 -07:00
swift-ci
b740acca62 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-16 16:09:51 -07:00
Ellie Shin
e362264b37 Merge pull request #77054 from swiftlang/elsh/pcmo-merge-funcs
[NFC] [Package CMO] Move shouldSerialize into canSerializeFunction
2024-10-16 15:41:07 -07:00
swift-ci
afd7266ff7 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-16 14:17:33 -07:00
Andrew Trick
24ed33bec0 Merge pull request #77040 from atrick/predmem_markdep
PredictableMemOpts: handle mark_dependence
2024-10-16 14:00:46 -07:00
swift-ci
c5a026a46b Merge remote-tracking branch 'origin/main' into rebranch 2024-10-16 12:14:51 -07:00
elsh
e0945e9d0d [Package CMO] Move shouldSerialize into canSerializeFunction
Remove redundant checks and consolidate serializability logic into one.
2024-10-16 12:05:04 -07:00
Ellie Shin
6b5df5225c Merge pull request #76832 from swiftlang/elsh/pcmo-refactor
[PackageCMO] Use InstructionVisitor to check inst serializability.
2024-10-16 12:00:33 -07:00
swift-ci
0462851544 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-16 09:56:16 -07:00
nate-chandler
b5e3f42cad Merge pull request #77044 from nate-chandler/rdar137960229
[DiagnoseUnreachable] Ignore dead_end destroys.
2024-10-16 09:41:48 -07:00
Nate Chandler
ce368e8220 [DiagnoseUnreachable] Ignore dead_end destroys.
Such destroys mark the lifetime end of their operands along their
availability boundary.  They are currently inserted in this test case
by the ClosureLifetimeFixup pass, but in the fullness of time they will
be present for every value which is not explicitly destroyed (that's
what complete OSSA lifetimes is mostly about).

Currently, such destroys are diagnosed by DiagnoseUnreachable.  Fix the
diagnostic pass not to diagnose these valid instructions.

rdar://137960229
2024-10-15 21:00:16 -07:00
Andrew Trick
af86ad1e16 Test predictable memopt mark_dependence semantics.
Unit tests for mark_dependence support. Required to fix unsafeAddress.
2024-10-15 16:52:07 -07:00
Andrew Trick
19c1617059 PredictableMemOpts: handle mark_dependence source promotion 2024-10-15 16:48:36 -07:00
elsh
7b358c25f4 Override getMappedValue with operand type checks. 2024-10-15 15:29:52 -07:00
Andrew Trick
2e9daa444d PredictableMemOpts: handle MarkDependence base uses. 2024-10-15 11:18:43 -07:00
Andrew Trick
830a3664f1 Rename overloaded computeAvailableValues.
Overloaded names create confusion.
2024-10-15 11:18:43 -07:00
swift-ci
01e1e21703 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-15 08:54:47 -07:00
Erik Eckstein
709dfc2d21 MandatoryPerformanceOptimization: don't let not-inlinable functions to be inlined
Also refactor canInline.

Fixes a compiler crash.
rdar://137544788
2024-10-15 12:19:50 +02:00
swift-ci
075ad5bcad Merge remote-tracking branch 'origin/main' into rebranch 2024-10-14 19:27:07 -07:00
Andrew Trick
e767d7ec26 Merge pull request #76996 from atrick/predmem_refactor
[NFC] PredictableMemOpts: refactor to allow extension
2024-10-14 19:07:07 -07:00
elsh
f87c5ba69a [Package CMO] Use InstructionVisitor to check if inst can be serialized.
Currently, InstructionVisitor is only used during the serialization pass,
that comes after a pass that checks if instructions are serializable. This
causes inconsistencies as some types bypass the first pass but are processed
in the second, leading to assert fails.

This PR uses InstructionVisitor in the first pass to be exhaustive and to
be consistent with the coverage in the second pass. The downside is the visitor
is SILCloner, which introduces overhead of cloning and discarding insts per pass
-- a potential area for future refactoring.

Resolves rdar://130788545.
2024-10-14 17:33:55 -07:00
swift-ci
8cce69d0ad Merge remote-tracking branch 'origin/main' into rebranch 2024-10-14 11:35:01 -07:00
Erik Eckstein
5c8fe55449 embedded: fix several issues with vtable specialization
* fix a false error if a derived class has different generic parameters than its base class
* fix a similar problem if a non-generic class derives from a generic class
* fix a compiler crash for calling a class method on a class metatype

rdar://137692055
2024-10-14 14:43:11 +02:00
Erik Eckstein
e0533e6125 SIL: add an API to replace all entries of a VTable
* add `ModulePassContext.replaceVTableEntries()`
* add `ModulePassContext.notifyFunctionTablesChanged()`
2024-10-14 14:43:11 +02:00
Andrew Trick
1ceebec1a0 [NFC] move a block of code into the correct heading.
No source change here, only reorganization that was deferred to avoid
making diffs hard to read.
2024-10-13 16:36:20 -07:00
Andrew Trick
2fd9e5e196 PredictableMemOpt: remove non-OSSA support
PredictableMemOpt only runs with OSSA. The recent refactoring did not
preserve non-OSSA conditions because it adds complexity. This commit
just makes it official.

In the near future, this pass will be replaced by an OSSA-only pass
anyway, so this brings us one small step closer to that.
2024-10-12 23:16:18 -07:00