swift-ci
ae30cba296
Merge remote-tracking branch 'origin/main' into rebranch
2023-09-13 10:20:48 -07:00
Kuba Mracek
56085205d8
[embedded] specialize generic classes based on MetatypeInst too, fix lazy emit assert
2023-09-12 21:24:14 -07:00
Kuba Mracek
e2de477609
[embedded] avoid metadata accessors, fix vtable map, add a diagnostic on non-final generic functions
2023-09-12 16:57:09 -07:00
Kuba Mracek
d0c2a4ccf8
[embedded] Initial support for generic classes in embedded Swift
...
- VTableSpecializer, a new pass that synthesizes a new vtable per each observed concrete type used
- Don't use full type metadata refs in embedded Swift
- Lazily emit specialized class metadata (LazySpecializedClassMetadata) in IRGen
- Don't emit regular class metadata for a class decl if it's generic (only emit the specialized metadata)
2023-09-12 09:44:54 -07:00
swift-ci
ab9f05c4e8
Merge remote-tracking branch 'origin/main' into rebranch
2023-09-05 10:53:23 -07:00
Meghana Gupta
f177be06ab
Merge pull request #68325 from meg-gupta/fixnonestoremem2reg
...
Fix handling of none value stores to non-trivial enums in Mem2Reg
2023-09-05 10:39:25 -07:00
Meghana Gupta
c89dcd8019
Fix handling of none value stores to non-trivial enums in Mem2Reg
...
We allow none values to be stored to a non-trivial enum.
For such store_borrow, `LiveValues::forValues` used
an Owned storage type, but endLexicalLifetime expected Guaranteed
storage type, leading to a compiler crash.
For store_borrow, use the LiveValues::forGuaranteed and for store
use LiveValues::forOwned to avoid this.
Fixes rdar://114390472
2023-09-04 23:31:29 -07:00
Sophia Poirier
86d368f364
Merge remote-tracking branch 'upstream/main' into fix-rebranch-automerger
2023-08-31 14:10:52 -07:00
Michael Gottesman
37d60a08bb
[move-only] Rename mark_must_check -> mark_unresolved_non_copyable_value.
...
I was originally hoping to reuse mark_must_check for multiple types of checkers.
In practice, this is not what happened... so giving it a name specifically to do
with non copyable types makes more sense and makes the code clearer.
Just a pure rename.
2023-08-30 22:29:30 -07:00
Nate Chandler
6ccd08b4e0
Merge branch 'main' into rebranch.
...
Resolve conflicts introduced in
https://github.com/apple/swift/pull/67944 as follows:
```
diff --git a/include/swift/Runtime/RuntimeFunctions.def b/include/swift/Runtime/RuntimeFunctions.def
index 3c973b5884b..44cde707d17 100644
--- a/include/swift/Runtime/RuntimeFunctions.def
+++ b/include/swift/Runtime/RuntimeFunctions.def
@@ -2537,16 +2537,10 @@ FUNCTION(AutoDiffCreateLinearMapContextWithType,
swift_autoDiffCreateLinearMapContextWithType, SwiftCC,
DifferentiationAvailability,
RETURNS(RefCountedPtrTy),
-<<<<<<< HEAD
- ARGS(SizeTy),
+ ARGS(TypeMetadataPtrTy),
ATTRS(NoUnwind),
EFFECT(AutoDiff),
MEMEFFECTS(ArgMemOnly))
-=======
- ARGS(TypeMetadataPtrTy),
- ATTRS(NoUnwind, ArgMemOnly),
- EFFECT(AutoDiff))
->>>>>>> public-github/main
// void *swift_autoDiffProjectTopLevelSubcontext(AutoDiffLinearMapContext *);
FUNCTION(AutoDiffProjectTopLevelSubcontext,
@@ -2563,16 +2557,10 @@ FUNCTION(AutoDiffAllocateSubcontextWithType,
swift_autoDiffAllocateSubcontextWithType, SwiftCC,
DifferentiationAvailability,
RETURNS(Int8PtrTy),
-<<<<<<< HEAD
- ARGS(RefCountedPtrTy, SizeTy),
+ ARGS(RefCountedPtrTy, TypeMetadataPtrTy),
ATTRS(NoUnwind),
EFFECT(AutoDiff),
MEMEFFECTS(ArgMemOnly))
-=======
- ARGS(RefCountedPtrTy, TypeMetadataPtrTy),
- ATTRS(NoUnwind, ArgMemOnly),
- EFFECT(AutoDiff))
->>>>>>> public-github/main
```
2023-08-24 16:24:32 -07:00
Kshitij Jain
d5a3e2e630
[AutoDiff] Fixes memory leaks in autodiff linear map context allocation builtins ( #67944 )
...
When the differentiating a function containing loops, we allocate a linear map context object on the heap. This context object may store non-trivial objects, such as closures, that need to be released explicitly. Fix the autodiff linear map context allocation builtins to correctly release such objects and not just free the memory they occupy.
2023-08-24 13:57:10 -07:00
swift-ci
bfd11fb143
Merge remote-tracking branch 'origin/main' into rebranch
2023-08-24 07:13:46 -07:00
nate-chandler
3687ddfac6
Merge pull request #68090 from nate-chandler/rdar114323803
...
[CopyPropagation] Don't try to delete owned values on which canonicalization bails.
2023-08-24 07:03:06 -07:00
Nate Chandler
a67c22d905
[CopyPropagation] Only delete if canonicalized.
...
Owned lifetime canonicalization bails on move-only values.
Previously, though, every value that was fed to canonicalization was
then attempted to be deleted. For dead move-only values, the result
could be to shorten move-only lifetimes, which is illegal per language
rules.
Here, this is fixed by not attempting to delete owned values for which
canonicalization bailed.
rdar://114323803
2023-08-23 11:42:57 -07:00
swift-ci
174b6bc00c
Merge remote-tracking branch 'origin/main' into rebranch
2023-08-18 19:34:12 -07:00
swift-ci
978395bc11
Merge pull request #62959 from meg-gupta/simplifycfgossapr3
...
Migrate simple and dominator based jump threading to OSSA
2023-08-18 17:18:10 -07:00
Meghana Gupta
9311e948a5
Avoid unnecessary block arguments in SimplifyCFG::threadEdge and SimplifyCFG::simplifyThreadedTerminators
2023-08-17 10:33:22 -07:00
Meghana Gupta
bbd6a87e2b
Fix simplifyArguments for a few edges cases in OSSA
2023-08-16 23:14:36 -07:00
swift-ci
d3fe8a6f97
Merge remote-tracking branch 'origin/main' into rebranch
2023-08-15 06:54:22 -07:00
Nate Chandler
0403ab102d
[Mem2Reg] Don't canonicalize erased vals.
...
To eliminate copies which become newly spurious, Mem2Reg canonicalizes
the lifetimes of values that are stored and of newly introduced phis
after rewriting.
It's possible, however, for the values that are stored to be deleted
during canonicalization if a value and its copy are both stored to the
address. Such values must not be canonicalized. So check whether
values have been erased before canonicalizing them.
rdar://113762355
2023-08-14 15:08:57 -07:00
Meghana Gupta
93d6f93435
Fixes to SimplifyCFG::threadEdge for OSSA
2023-08-14 11:36:05 -07:00
Meghana Gupta
05c7d64511
We don't consider it profitable to jump thread when we could optimize arc in OSSA.
...
Copy propagation should be able to handle such cases without jump threading.
2023-08-14 11:36:04 -07:00
Meghana Gupta
e3a98e88f3
Add new flags to enable specific SimplifyCFG operations
2023-08-14 11:36:04 -07:00
Meghana Gupta
a303bb4519
Disable SimplifyCFG::tailDuplicateObjCMethodCallSuccessorBlocks in OSSA
...
Support for this needs to be added
2023-08-14 11:36:04 -07:00
Meghana Gupta
bf68e3ff39
Disable ArgumentSplitter for non trivial types in ossa
2023-08-14 11:36:04 -07:00
swift-ci
3561327bdb
Merge remote-tracking branch 'origin/main' into rebranch
2023-08-08 21:33:48 -07:00
Meghana Gupta
1075f77822
Merge pull request #67521 from meg-gupta/migratedoe
...
Migrate DeadObjectElimination to OSSA
2023-08-08 21:27:06 -07:00
swift-ci
9742461a27
Merge remote-tracking branch 'origin/main' into rebranch
2023-08-08 13:17:04 -07:00
Meghana Gupta
848466acbe
Ensure no module transform is added in the function pipeline
2023-08-08 11:04:46 -07:00
Meghana Gupta
996fd8b978
Bail out from deleting a dead objection on seeing stores with lexical non-trivial source
2023-08-08 10:48:09 -07:00
Meghana Gupta
abdb9f0dba
DeadObjectElimination: Handle allocating apply in ossa
2023-08-07 14:58:57 -07:00
Meghana Gupta
2831f2f528
Add findPointerEscape check on store source, before shortening its lifetime by inserting destroy at the store
2023-08-07 10:21:40 -07:00
Meghana Gupta
c3c78fa8f8
DeadObjectElimination: Handle alloc_ref in ossa
2023-08-07 10:21:40 -07:00
Meghana Gupta
f5c5c9e36b
In non-ossa, ban non-trivial stores to alloc_ref's projections even the dtor is not inlined
...
There is no implementation to handle insertion of compensating releases of the non-trivial store's src for this case.
This never really happens, because destructor analysis is very limited and we end up banning alloc_ref with ref count instructions.
2023-08-07 10:21:40 -07:00
Meghana Gupta
768d98e1c4
Add a TODO in destructor analysis
2023-08-07 10:21:40 -07:00
Meghana Gupta
15e5364d25
DeadObjectElimination: Handle keypaths with non-trivial operands in OSSA
2023-08-07 10:21:40 -07:00
Meghana Gupta
41697b061c
DeadObjectElimination: Handle non-trivial stores while processing alloc_stack
2023-08-07 10:21:40 -07:00
swift-ci
8308afaaf0
Merge remote-tracking branch 'origin/main' into rebranch
2023-08-01 17:33:45 -07:00
Joe Groff
03eec7da2b
Remove redundant SILType::isMoveOnlyNominalType (NFC)
...
and implement `SILType::isPureMoveOnly` in terms of `Type::isPureMoveOnly`.
2023-08-01 14:07:38 -07:00
swift-ci
7bef9fd31a
Merge remote-tracking branch 'origin/main' into rebranch
2023-07-31 21:34:34 -07:00
Nate Chandler
4f16bb1a74
[Mem2Reg] Don't canonicalize undef.
...
They aren't the kind of values whose lifetimes are eligible for
canonicalization.
rdar://113121424
2023-07-31 16:20:37 -07:00
Nate Chandler
f276ebf37e
[Mem2Reg] Only lifetime canonicalize in OSSA.
...
Bail both on collecting stores and canonicalizing values if the function
being optimized doesn't have ownership.
2023-07-31 16:16:28 -07:00
swift-ci
1c1be7d116
Merge remote-tracking branch 'origin/main' into rebranch
2023-07-28 15:36:57 -07:00
swift-ci
1cca22bafe
Merge pull request #67526 from nate-chandler/mem2reg/canonicalize-values
...
[Mem2Reg] Canonicalize promoted lifetimes.
2023-07-28 15:30:59 -07:00
Nate Chandler
b563c4ea3d
[Mem2Reg] Canonicalize new phis.
...
Mem2Reg introduces new OSSA values in the form of phis. Take
responsibility for canonicalizing their lifetimes.
2023-07-28 13:21:13 -07:00
Nate Chandler
52ce100ef4
[Mem2Reg] Canonicalize stored values.
...
Stored values may now be canonicalizable, now that they have one less
consuming use.
2023-07-28 13:19:52 -07:00
swift-ci
1ead4ffed7
Merge remote-tracking branch 'origin/main' into rebranch
2023-07-28 10:57:58 -07:00
Nate Chandler
e5d87f75a8
[SIL] Add source formal type to checked_cast_br.
...
It is necessary for opaque values where for casts that will newly start
out as checked_cast_brs and be lowered to checked_cast_addr_brs, since
the latter has the source formal type, IRGen relies on being able to
access it, and there's no way in general to obtain the source formal
type from the source lowered type.
2023-07-27 15:04:15 -07:00
Nate Chandler
7fb9bcade8
[Mem2Reg] NFC: Lifted livePhiBlocks higher.
...
Move it all the way up into MemoryToRegisters::run in preparation for
using it to canonicalize new phis.
2023-07-26 21:27:35 -07:00
Nate Chandler
c9e0bb5a67
[Mem2Reg] NFC: Removed spurious typealias.
...
`BlockSetVector` is not much shorter than `BasicBlockSetVector`, and there's
no reason to tie the type to `StackAllocationPromoter`.
2023-07-26 21:27:35 -07:00