Commit Graph

11193 Commits

Author SHA1 Message Date
Nate Chandler
dd19acdf68 [Test] Underscored simplify_cfg_canonicalize_switch_enum.
Use underscores rather than hyphens so that text editors understand the
name as a single word.
2024-07-25 13:50:17 -07:00
Nate Chandler
4329512fb0 [Test] Underscored simplify_cfg_simplify_term_with_identical_dest_blocks.
Use underscores rather than hyphens so that text editors understand the
name as a single word.
2024-07-25 13:50:17 -07:00
Nate Chandler
b0bb97467f [Test] Underscored simplify_cfg_simplify_switch_enum_block.
Use underscores rather than hyphens so that text editors understand the
name as a single word.
2024-07-25 13:50:17 -07:00
Nate Chandler
c0d95c121b [Test] Underscored simplify_cfg_simplify_switch_enum_on_objc_class_optional.
Use underscores rather than hyphens so that text editors understand the
name as a single word.
2024-07-25 13:50:14 -07:00
Nate Chandler
7470c29cfe [Test] Underscored simplify_cfg_simplify_switch_enum_unreachable_blocks.
Use underscores rather than hyphens so that text editors understand the
name as a single word.
2024-07-25 13:48:22 -07:00
Nate Chandler
8d3a5a17d9 [Test] Underscored simplify_cfg_try_jump_threading.
Use underscores rather than hyphens so that text editors understand the
name as a single word.
2024-07-25 13:47:45 -07:00
swift-ci
24381eddc3 Merge remote-tracking branch 'origin/main' into rebranch 2024-07-25 12:33:16 -07:00
nate-chandler
840198ec9b Merge pull request #73275 from nate-chandler/lifetime-completion/enable
[LifetimeCompletion] Enable.
2024-07-25 12:29:44 -07:00
Nate Chandler
92e5dc84cd [ClosureLifetimeFixup] Flag dead-end destroys. 2024-07-24 17:56:31 -07:00
Nate Chandler
c726366f88 [OwnedLifetimeCan] Persist [dead_end].
When creating `destroy_value`s, create them with the `dead_end` flag if
all subsequent destroys (those from which it is notionally being
hoisted) have the flag.
2024-07-24 17:56:31 -07:00
swift-ci
8093bbb848 Merge remote-tracking branch 'origin/main' into rebranch 2024-07-24 17:33:17 -07:00
Nate Chandler
95b8eef292 [NFC] OwnedLifetimeCan: Use isWithinBoundary.
Now that `isWithinBoundary` and `areUsesWithinBoundary` are "the same"
(up to the fact that one takes an instruction and the other an array of
operands), there's no reason to use the latter when looking at a single
instruction.
2024-07-24 11:28:00 -07:00
swift-ci
f1ea924a51 Merge remote-tracking branch 'origin/main' into rebranch 2024-07-24 10:14:18 -07:00
Allan Shortlidge
66e2f972ab Merge pull request #75432 from tshortli/maccatalyst-upstream
Upstream missing macCatalyst support
2024-07-24 09:58:04 -07:00
swift-ci
7203e893f7 Merge remote-tracking branch 'origin/main' into rebranch 2024-07-23 21:14:07 -07:00
Allan Shortlidge
e4331af916 IRGen: Introduce macCatalyst target variant version check builtins. 2024-07-23 17:00:10 -07:00
Nate Chandler
042241af55 [NFC] MoveOnlyAddressChecker: Use isWithinBoundary
Switch back to the API meant for a single instruction now that it
properly handles dead-end regions.
2024-07-23 13:38:35 -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
aa8ccafd20 [OwnedLifetimeCan] Prune fewer debug_values.
Use the more precise areUsesWithinBoundary API (which takes dead-end
blocks into account).  This requires first updating liveness with the
newly created destroys.
2024-07-22 21:51:33 -07:00
Nate Chandler
001c41741a [NFC] OwnedLifetimeCan: Record new destroys.
Add them to a small vector.  For now, do nothing with them.
2024-07-22 21:51:33 -07:00
Nate Chandler
4a397cc018 [NFC] OwnedLifetimeCan: Take DeadEndBlocksAnalysis
All clients of OwnedLifetimeCanonicalization pass an instance of the
analysis in.  For now, it's unused.
2024-07-22 21:51:28 -07:00
Nate Chandler
11abefee60 [NFC] SILCombine: Use DeadEndBlocksAnalysis.
Instead of having a separately calculated version.
2024-07-22 20:35:30 -07:00
Nate Chandler
b5e4fcf100 [NFC] CopyPropagation: Extracted verification.
It makes it easier to temporarily hack in new calls to verify.
2024-07-22 20:35:30 -07:00
Nate Chandler
e125c5cf64 [NFC] SILOptimizer: Remove LexicalDestroyHoisting.
It has been superseded by OwnedValueCanonicalization's support for
lexical values.
2024-07-22 20:35:30 -07:00
Nate Chandler
d55c169d80 [CopyPropagation] Destroy hoist -> canonicalize.
Replace usages of lexical destroy hoisting with owned value
canonicalization now that the latter supports lexical values.
2024-07-22 20:35:30 -07:00
Nate Chandler
afca04dd08 [OwnedLifetimeCan] Fix clearing.
Just clear all structures in a single method which is called wherever
clearing is done.  Fixes a failure to clear discoveredBlocks under
certain circumstances.
2024-07-22 20:35:29 -07:00
Nate Chandler
f31254150a [NFC] OwnedLifetimeCan: Extracted dead-end visit.
This is separate from deinit barrier visiting, and will be deleted once
complete lifetimes are finished.
2024-07-22 20:35:29 -07:00
Nate Chandler
800cd3f942 [NFC] OwnedLifetimeCan: Remove spurious array.
Inlined a single-caller method and removed the array that was created
only to be iterated over once.
2024-07-22 20:35:29 -07:00
Nate Chandler
6fd25f695e [OwnedLifetimeCan] Barriers affect direct destroys
Copies of a lexical lifetime are not lexical.  Their destroys can be
hoisted over deinit barriers.  So when extending lifetimes to deinit
barriers, only deal with the direct lifetime, not the copy-extended
lifetime.
2024-07-22 20:35:29 -07:00
Nate Chandler
a60f05ebc1 [NFC] OwnedLifetimeCan: Used for-in loop. 2024-07-22 20:35:29 -07:00
swift-ci
acdd020fa1 Merge remote-tracking branch 'origin/main' into rebranch 2024-07-22 20:35:14 -07:00
Nate Chandler
3eb288f92e [MoveOnlyAddressChecker] Exclusivity handles DEs.
Switch to the areUsesWithinBoundary API which takes dead-ends into
account.

rdar://131960619
2024-07-22 14:03:49 -07:00
swift-ci
0b785e57a7 Merge remote-tracking branch 'origin/main' into rebranch 2024-07-19 02:34:28 -07:00
Michael Gottesman
bcbf5c515e [region-isolation] Emit an error when we assign a non-disconnected value into a sending result.
rdar://127318392
2024-07-18 21:29:08 -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
Michael Gottesman
ace94b00ba [region-isolation] Move RepresentativeValue from RegionAnalysis.h -> PartitionUtils.h and add APIs for mapping an ElementID -> Representative.
This is just moving up the declaration in the chain of dependencies so that I
can write logic in PartitionUtils.h using it. I also added entrypoints to lookup
the ReprensetativeValue for our various emitters.
2024-07-18 21:28:22 -07:00
Michael Gottesman
75152e7834 [region-isolation] Teach region isolation how to handle cases where due to compiler bugs, we have a function isolated to self without an isolated parameter.
Closures generally only inherit actor instance isolation if they directly
capture state from the actor instance. In this case, for some reason that is not
true, so we hit an assert that assumes that we will only see a global actor
isolated isolation.

Region Isolation should be able to handle code even if the closure isolation
invariant is violated by the frontend. So to do this, I am introducing a new
singleton actor instance to represent the isolation of a defer or closure
created in an actor instance isolated method. The reason why I am using a
singleton is that closures and defer are not methods so we do not actually know
which parameter is 'self' since it isn't in the abi. But we still need some
value to represent the captured values as belonging to. To square this circle, I
just did what we have done in a similar situation where we did not have a value:
(ActorAccessorInit). In that case, we just use a sentinel to represent the
instance (NOTE: This is represented just via a kind so ActorInstances that are
operator== equal will not &value equal since we are just using a kind).
2024-07-18 21:28:22 -07:00
swift-ci
935d70c4ba Merge remote-tracking branch 'origin/main' into rebranch 2024-07-18 10:54:24 -07:00
nate-chandler
e9279e2f23 Merge pull request #75292 from nate-chandler/rdar131882748
[Mem2Reg] Bail on address-only types.
2024-07-18 10:52:03 -07:00
swift-ci
f4bd8d1be5 Merge remote-tracking branch 'origin/main' into rebranch 2024-07-17 19:34:54 -07:00
Michael Gottesman
219073be97 Revert "[region-isolation] Make "unknown pattern error" always an error."
This reverts commit b63781f7ba.

We found some cases where due to malformed IR that we allow through due to
either us compiling for strict-concurrency=complete+swift-5 or swift-6 +
preconcurrency, that we can actually have actor isolation mismatch. I am going
to in a subsequent commit add a better phrasing here. But for now, just undo the
conversion from error -> warning.

rdar://131757602
2024-07-17 16:09:55 -07:00
Nate Chandler
1b9567b1d3 [Mem2Reg] Bail on address-only types.
It is impossible to have a value of address-only type, so don't try
promoting.

rdar://131882748
2024-07-17 08:11:35 -07:00
swift-ci
9ff3a56926 Merge remote-tracking branch 'origin/main' into rebranch 2024-07-15 04:36:05 -07:00
Erik Eckstein
823036d5a1 embedded: fix vtable specialization for nested classes
Fixes a crash in case of an inner class (with no generic parameters), which is nested inside another generic type, like
```
struct G<T> {
  class Inner {}
}
```

rdar://131311511
2024-07-12 21:44:49 +02:00
swift-ci
237c10a444 Merge remote-tracking branch 'origin/main' into rebranch 2024-07-11 21:54:45 -07:00
Anton Korobeynikov
9d63e0fa36 [AutoDiff] Correctly propagate optional adjoint through switch_enum (#74985)
Fixes #74978
2024-07-11 21:48:00 -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
Slava Pestov
d1847ffde7 Merge pull request #75068 from slavapestov/simplify-sub-map
Simplify and optimize SubstitutionMap
2024-07-10 20:45:56 -04:00
Michael Gottesman
8e5222e6d5 Merge pull request #75137 from gottesmm/pr-cd357557374bb800097ac08777ae16e5e8082abb
[region-isolation] Make "unknown pattern error" always an error.
2024-07-10 16:46:11 -07:00