Commit Graph

6583 Commits

Author SHA1 Message Date
Nate Chandler
d76a8e671e [NFC] SIL: Typed destroy_value.poisonRefs.
Type the existing flag before adding another flag.
2024-07-03 14:53:30 -07:00
Ben Barham
c4fd432b6c [SIL] Add missing ilist details 2024-07-01 14:52:51 -07:00
swift-ci
aaba96e5c5 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-30 05:35:30 -07:00
Meghana Gupta
ab3eaf2441 Merge pull request #71881 from meg-gupta/fixmem2reg
Fix mem2reg of lexical enum stack locations
2024-06-30 05:31:24 -07:00
Meghana Gupta
79acb5ac47 Fix ownership of move-only enums in SIL 2024-06-29 22:58:45 -07:00
swift-ci
84d48435eb Merge remote-tracking branch 'origin/main' into rebranch 2024-06-28 15:14:47 -07:00
nate-chandler
c5bc2c378d Merge pull request #74815 from nate-chandler/rdar130427564
[PrunedLiveness] Branch summary merges to ending.
2024-06-28 15:05:07 -07:00
swift-ci
f2e68e5db1 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-28 11:36:11 -07:00
Ben Barham
d8f381e660 Merge pull request #74804 from bnbarham/rename-equals
Update `StringRef::equals` references to `operator==`
2024-06-28 11:22:20 -07:00
Ben Barham
d72f5b12c4 Update StringRef::equals references to operator==
`equals` has been deprecated upstream, use `operator==` instead.
2024-06-27 19:14:06 -07:00
Nate Chandler
88445c5a46 [NFC] PrunedLiveness: Use std::min. 2024-06-27 16:18:03 -07:00
Ben Barham
b7954411ec Merge remote-tracking branch 'origin/main' into manually-merge-main-to-rebranch
Conflicts:
  - `include/swift/AST/PluginRegistry.h`
2024-06-27 14:56:11 -07:00
Akira Hatanaka
42bc49d3fe Add a new parameter convention @in_cxx for non-trivial C++ classes that are passed indirectly and destructed by the caller (#73019)
This corresponds to the parameter-passing convention of the Itanium C++
ABI, in which the argument is passed indirectly and possibly modified,
but not destroyed, by the callee.

@in_cxx is handled the same way as @in in callers and @in_guaranteed in
callees. OwnershipModelEliminator emits the call to destroy_addr that is
needed to destroy the argument in the caller.

rdar://122707697
2024-06-27 09:44:04 -07:00
Erik Eckstein
c576015d8a fix a crash when de-virtualizing class or actor methods with typed throws
The de-virtualizer utility didn't handle indirect error results when de-virtualizing class or actor methods.
This resulted in a missing argument for the indirect error result in the new try_apply instruction.

rdar://130545338
2024-06-27 09:47:33 +02:00
Joe Groff
636a19d11b Merge pull request #74707 from jckarter/consume-during-borrow-checks
MoveOnlyAddressChecker: More robust checking for consume-during-borrow.
2024-06-26 08:22:04 -07:00
swift-ci
517860f681 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-25 23:55:09 -07:00
eeckstein
31c07c95b0 Merge pull request #74689 from eeckstein/refactor-dynamic-self-check
SwiftCompilerSources: refactor `Function.mayBindDynamicSelf`
2024-06-26 08:47:18 +02:00
Joe Groff
27a8852290 MoveOnlyAddressChecker: More robust checking for consume-during-borrow.
- While an opaque borrow access occurs to part of a value, the entire scope of
  the access needs to be treated as a liveness range, so add the `EndAccess`es
  to the liveness range.
- The SIL verifier may crash the compiler on SILGen-generated code when the
  developer's source contains consume-during-borrow code patterns. Allow
  `load_borrow` instructions to be marked `[unchecked]`, which suppresses
  verifier checks until the move checker runs and gets a chance to properly
  diagnose these errors.

Fixes rdar://124360175.
2024-06-25 14:10:02 -07:00
Erik Eckstein
c61733f985 SwiftCompilerSources: refactor Function.mayBindDynamicSelf
Instead of bridging the whole function, just bridge `hasDynamicSelfMetadata` and do the other work in swift.
2024-06-25 17:59:23 +02:00
Erik Eckstein
718ea4b018 replace require with the new ASSERT macro 2024-06-25 10:45:55 +02:00
swift-ci
534620ceef Merge remote-tracking branch 'origin/main' into rebranch 2024-06-18 14:15:39 -07:00
Slava Pestov
cb1605f26f Merge pull request #74414 from slavapestov/pack-element-var
SIL: Fix lowering for 'var's whose types contain local archetypes
2024-06-18 17:14:50 -04:00
swift-ci
08c89c3ee6 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-18 09:14:51 -07:00
Akira Hatanaka
d92f181ace Create two versions (for caller and callee) of the functions that answer questions about parameter convention (#74124)
Create two versions of the following functions:

isConsumedParameter
isGuaranteedParameter
SILParameterInfo::isConsumed
SILParameterInfo::isGuaranteed
SILArgumentConvention::isOwnedConvention
SILArgumentConvention::isGuaranteedConvention

These changes will be needed when we add a new convention for
non-trivial C++ types as the functions will return different answers
depending on whether they are called for the caller or the callee. This
commit doesn't change any functionality.
2024-06-18 09:06:09 -07:00
Slava Pestov
e4d6108e11 SIL: Fix lowering for 'var's whose types contain local archetypes
A mutable 'var' becomes a SILBoxType, and we need to plumb the
correct generic signature through here too.

Fixes https://github.com/apple/swift/issues/71921.
2024-06-18 11:45:41 -04:00
swift-ci
bb865a7ae6 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-12 20:34:34 -07:00
nate-chandler
6694bbab90 Merge pull request #74360 from nate-chandler/rdar127518559
[ConsumeAddrChecker] Diagnose consumes of borrows.
2024-06-12 20:33:07 -07:00
Nate Chandler
29ee0ed56e [Gardening] Clarified documentation. 2024-06-12 13:12:21 -07:00
swift-ci
237c095033 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-12 11:56:39 -07:00
eeckstein
b7b93a12a0 Merge pull request #74329 from eeckstein/fix-block-cloning
SIL: update borrowed-from instructions when cloning a basic block
2024-06-12 20:38:13 +02:00
swift-ci
426f50c9c0 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-12 07:15:51 -07:00
nate-chandler
3aca85bfb3 Merge pull request #74298 from nate-chandler/rdar129593468
[NoncopyableWrapperElim] Process undef values.
2024-06-12 06:55:48 -07:00
Erik Eckstein
d80813ee3b SIL: update borrowed-from instructions when cloning a basic block
Cloning blocks might split CFG edges which can "convert" terminator result arguments to phi-arguments.
In this case a borrowed-from instruction must be inserted.

Fixes a SIL verifier crash caused by SimplifyCFG's jump threading.
rdar://129187525
2024-06-12 12:56:34 +02:00
Nate Chandler
fed3cb84c6 [NFC] SIL: Expose undef values. 2024-06-11 16:25:31 -07:00
Nate Chandler
f39b70a86d [NFC] SIL: Extracted remove "any" m-o wrapping. 2024-06-11 16:25:29 -07:00
Nate Chandler
78c18374c3 [NFC] SIL: Extracted has "any" move-only wrapping.
This predicate is used in several places.
2024-06-11 16:25:14 -07:00
Nate Chandler
b5b637c72e [NFC] SIL: Renamed helper.
removing...To -> removing...From
2024-06-11 16:25:11 -07:00
swift-ci
19d9da59d3 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-11 10:54:37 -07:00
Slava Pestov
322ce5a1ab SIL: Consistently drop substitution map when forming apply instructions
Fixes rdar://129298104.
2024-06-11 10:36:15 -04:00
swift-ci
15ebacd934 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-10 22:34:42 -07:00
eeckstein
8dec8f6058 Merge pull request #74259 from eeckstein/fix-fixed-abi-runtime-effects
PerformanceDiagnostics: avoid false meta-data alarms for non-loadable types
2024-06-11 07:26:34 +02:00
swift-ci
8c21deb9d0 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-10 11:33:40 -07:00
Erik Eckstein
717880e844 PerformanceDiagnostics: avoid false meta-data alarms for non-loadable types
Non-loadable types don't necessarily need metadata, for example, structs with `@_rawLayout`

https://github.com/apple/swift/issues/73951
2024-06-10 18:25:08 +02:00
Nate Chandler
5dc3cf1296 [LifetimeCompletion] Removed "with leaks" mode.
Now that the two known issues which resulted in invalid SIL being
provided to lifetime completion have been addressed, tighten up the
completion done on the availability boundary not to allow leaks.
2024-06-06 16:48:46 -07:00
swift-ci
be87ad7bcb Merge remote-tracking branch 'origin/main' into rebranch 2024-06-06 10:35:38 -07:00
Meghana Gupta
af1d6017f9 Merge pull request #74132 from meg-gupta/deleteresultdependson
Remove resultDependsOn/resultDependsOnSelf
2024-06-06 10:23:31 -07:00
swift-ci
a523f4942e Merge remote-tracking branch 'origin/main' into rebranch 2024-06-05 20:14:34 -07:00
Nate Chandler
84da0ed4c5 [LifetimeCompletion] Add extend_lifetimes.
The new instructions are inserted after every "user" (according to
InteriorLiveness' SSAPrunedLiveness instance) outside the linear
liveness boundary.
2024-06-05 16:28:28 -07:00
Nate Chandler
a52cc7ae19 [NFC] LifetimeCompletion: Note boundary kind.
When visiting an availability boundary, note what kind of end is
involved.  For now, there's only one.
2024-06-05 16:28:28 -07:00
Nate Chandler
81fa65772f [OwnershipLiveness] End at extend_lifetime.
When visiting consumes, also visit `extend_lifetime` instructions.
These instructions are not lifetime ending, but together with the
consumes, they enclose the users of a value.

Add a flag to LinearLiveness to control whether these instructions are
added so that the verifier can use verify that all such instructions
appear outside the linear lifetime boundary (not including them).
2024-06-05 16:28:28 -07:00