Commit Graph

136 Commits

Author SHA1 Message Date
nate-chandler
b4777083b0 Merge pull request #85128 from nate-chandler/rdar162922634
[CastOptimizer] Use TypeConverter to lower type.
2025-10-24 23:47:03 -07:00
Nate Chandler
ef6bd64e7f [CastOptimizer] Use TypeConverter to lower type.
rdar://162922634
2025-10-24 15:34:09 -07:00
Erik Eckstein
7dc4952b98 Revert "[test] Disable test to unblock CI"
This reverts commit e3a125a43f.
2025-10-14 20:17:43 +02:00
Anthony Latsis
e3a125a43f [test] Disable test to unblock CI 2025-10-14 02:15:10 +01:00
Nate Chandler
52822ded70 [DeadObjectElim] Bail on invalid access path.
rdar://162237650
2025-10-09 06:34:08 -07:00
Daniel Rodríguez Troitiño
e9ca11e669 [test] Add requires for embedded_stdlib for test that uses the stdlib (#84656)
The test enables the Embedded experimental feature, but beside the
compiler support, it also requires loading the stdlib for embedded, but
the test is not marked as such. For configurations that do not build the
embedded stdlibs, this makes the test fail, because the stdlib is not
available. Mark it with the appropriate requires to avoid this problem.

This should not change the results in the swift.org CI because those CI
configurations build the embedded stdlibs by default.
2025-10-03 13:57:33 -07:00
nate-chandler
5945606067 Merge pull request #84577 from nate-chandler/rdar161433604
[Optimizer] Use valid inst range to broadcast inlining changes.
2025-10-01 14:08:52 -07:00
Nate Chandler
07d75186ba [Optimizer] Don't walk to deleted.
During inlining, some instructions in the caller may be deleted.  So
when publishing this best effort list of instructions which were
"changed" during inlining, don't start from a deleted instruction.
Instead just don't publish, as already happens in other cases.

Without actually addressing
```
// TODO: get a list of cloned instructions from the `inlineFunction`
```
this is somewhat better than checking for having reached the end of the
function during the walk because that will result in falsely
broadcasting that some unchanged instructions have changed whereas this
change only results in not broadcasting which is already being done in
some cases (e.g. when a `begin_apply` is immediately followed by an
`end_apply`).
2025-09-29 20:52:18 -07:00
Nate Chandler
c17027aa41 [Test] Add failing test. 2025-09-29 20:52:18 -07:00
Nate Chandler
d844cc3b97 [ODL] Visit unchecked_ref_cast insts.
Eliminate them if they're just identity casts.
2025-09-26 17:06:42 -07:00
Nate Chandler
d0cd8acd64 [ODL] Visit autorelease_value insts.
No update is needed for the values they produce.  This pass should
really be refactored not to crash on instructions that aren't explicitly
listed or at least not to compile if not every instruction is listed.

rdar://161371112
2025-09-26 17:06:37 -07:00
nate-chandler
6cd7974c5a Merge pull request #84405 from nate-chandler/rdar160692694
[DiagnoseStaticExclusivity] Fix this assertion.
2025-09-19 19:37:50 -07:00
Nate Chandler
edf41ceff6 [DiagnoseStaticExclusivity] Fix this assertion.
This function is called in one place in an assertion.  It asserts that
the function in question is the stdlib's swap.  In language mode 6, the
called value may be wrapped in a `function_conversion_expr` for
`@Sendable`.  That's irrelevant for the purposes of this assertion, so
look through such conversions.

rdar://160692694
2025-09-19 11:47:31 -07:00
nate-chandler
d7d4ba391a Merge pull request #84378 from nate-chandler/rdar160742150
[AllocBoxToStack] Fix missing [nothrow] of apply.
2025-09-18 21:27:23 -07:00
Nate Chandler
30098ad3e0 [AllocBoxToStack] Fix missing [nothrow] of apply.
When specializing an apply which is annotated `[nothrow]`, the resulting
function's apply must still be annotated `[nothrow]`.

rdar://160742150
2025-09-18 12:20:28 -07:00
Nate Chandler
9bbfb2106b [SILVerifier] Ease this over-strict verification.
It's permitted for a `witness_method` instruction to have multiple
type-dependent operands.  This can happen when for example when one
local archetype is defined in terms of another.

rdar://159211502
2025-09-09 15:44:08 -07:00
Nate Chandler
aa85694237 [NFC] OSSACompleteLifetime: Renamed. 2025-08-18 09:45:19 -07:00
Nate Chandler
d8710fc83d [OSSACompleteLifetime] Fix error message. 2025-08-18 08:44:10 -07:00
Nate Chandler
0a6c712195 [OSSACompleteLifetime] Flag disables leak checking
The utility effectively determines whether a value leaks as part of its
work, a subset of the checking done by the ownership verifier.  Disable
that checking when the flag that disables the ownership verifier is
passed.
2025-08-15 11:06:18 -07:00
Nate Chandler
c197ca107e [OSSACompleteLifetime] Promote assertion.
Use llvm::report_fatal_error instead.  Also, add logging to clarify that
reaching this point is a bug in the incoming SIL.
2025-08-15 09:09:04 -07:00
Nate Chandler
fc4a49334f [ODL] Visit objc_method insts.
No update is needed for the values they produce.  This pass should
really be refactored not to crash on instructions that aren't explicitly
listed or at least not to compile if not every instruction is listed.

rdar://155059418
2025-07-08 17:19:56 -07:00
Nate Chandler
a3c460988c [Test] Remove old test.
This test was never well-targeted and has been disabled for years.  We
have better coverage elsewhere.

rdar://98890125
2025-06-25 11:42:34 -07:00
Meghana Gupta
8396a6d8c0 Fix an inliner crash when inlining begin_apply with scoped lifetime dependence
LifetimeDependenceInsertion inserts mark_dependence on token result of a begin_apply
when it yields a lifetime dependent value. When such a begin_apply gets inlined,
the inliner can crash because of the remaining uses of the token result.

Fix this by inserting mark_dependence on parameter operands that are lifetime dependence sources
and deleting the mark_dependence on token results in the inliner.

Fixes rdar://151568816
2025-06-12 01:35:36 -07:00
Eric Miotto
00334acf37 Disable tests that require arm64e slices for iOS sanitizers
We started building iOS sanitizers when switching to
`LLVM_ENABLE_RUNTIMES` to build compiler-rt, and turns out they
currently provide only the arm64 slice.

Addresses rdar://151782340
2025-05-22 14:40:07 -07:00
nate-chandler
8959f60ab1 Merge pull request #81566 from nate-chandler/rdar151325025
[MoveOnlyChecker] Don't complete phis.
2025-05-19 07:21:21 -07:00
Nate Chandler
9b3db3646a [MoveOnlyChecker] Don't complete phis.
Apply the MoveOnlyAddressChecker change from
https://github.com/swiftlang/swift/pull/73358 to the
MoveOnly[Value]Checker.

After 7713eef817, before running value
checking, all lifetimes in the function are completed.  That doesn't
quite work because lifetime completion expects not to encounter
reborrows or their adjacent phis.

rdar://151325025
2025-05-16 11:58:44 -07:00
Nate Chandler
1765f0b1e0 [MoveOnly] Fix consume of addr with mutated field.
Don't fail out of use visitation when encountering an apply which uses a
field of the value as an inout parameter.

rdar://139666145
2025-05-15 15:19:26 -07:00
Erik Eckstein
ec4d40cdbe tests: increase the timeout for large_nested_array.swift.gyb
This fixes a timeout failure in CI. It looks like that some CI machines are slower than expected.
I could not reproduce this locally. There doesn't seem to be a compile time regression.
2025-04-24 09:27:37 +02:00
Nate Chandler
4786bede68 [MoveOnly] Fix consumption of opened existentials.
Enable walking into `TypeOffsetSizePair`s from an existential into an
archetype.  And set the access kind on `open_existential_addr`
instructions which are the sources of rewritten `copy_addr`s to mutable.

rdar://141279635
2025-04-22 17:59:37 -07:00
Erik Eckstein
328e6aad07 ConstExpr: fix handling of store_borrow
The `store_borrow` instruction has a result and that must be set.
Fixes a false error of the OSLogOptimization.
rdar://144896232
2025-02-19 13:30:07 +01:00
Erik Eckstein
85736fb703 tests: increase timeout of SILOptimizer/large_c_struct.swift
I have to take into account that CI machines are sometimes not so fast.
rdar://144921565
2025-02-16 18:28:13 +01:00
Erik Eckstein
b07a06cd16 tests: increase the timeout for SILOptimizer/large_nested_array.swift.gyb
The test run time jumped from ~200s to ~600s on Linux.
Unfortunately I could not reproduce this locally.
But what I saw is that ARCSequenceOpts is taking 75% of the compile time: rdar://144863155

Let's increase the timeout a bit until we can get rid of ARCSequenceOpts.

rdar://144810758
2025-02-14 15:54:38 +01:00
Erik Eckstein
d351d10845 tests: add a testfile for a predictable-memory-opt complexity problem.
Reported here: https://github.com/swiftlang/swift/issues/56221
rdar://72885279
2025-02-07 11:30:35 +01:00
Hiroshi Yamauchi
7abb94a5f4 Add a reproducer for issue 78447
https://github.com/swiftlang/swift/issues/78447
2025-01-13 11:28:44 -08:00
nate-chandler
0d76250033 Merge pull request #77908 from nate-chandler/rdar139840307
[BarrierAccessScopes] Handle end_access instructions' barrierness introduced during run.
2024-12-04 15:29:02 -08:00
Nate Chandler
f79def4cee [BarrierAccessScopes] Handle found gen locality.
As the utility runs, new gens may become local: as access scopes are
determined to contain deinit barriers, their `end_access` instructions
become kills; if such an `end_access` occurs in the same block above an
initially-non-local gen, that gen is now local.

Previously, it was asserted that initially-non-local gens would not
encounter when visiting the block backwards from that gen.  Iteration
would also _stop_ at the discovered kill, if any.  As described above,
the assertion was incorrect.

Stopping at the discovered kill was also incorrect.  It's necessary to
continue walking the block after finding such a new kill because the
book-keeping the utility does for which access scopes contain barriers.
Concretely, there are two cases:
(1) It may contain another `end_access` and above it a deinit barrier
which must result in that second scope becoming a deinit barrier.
(2) Some of its predecessors may be in the region, all the access scopes
which are open at the begin of this block must be unioned into the set
of scopes open at each predecessors' end, and more such access scopes
may be discovered above the just-visited `end_access`.

Here, both the assertion failure and the early bailout are fixed by
walking from the indicated initially-non-local gen backwards over the
entire block, regardless of whether a kill was encountered.  If a kill
is encountered, it is asserted that the kill is an `end_access` to
account for the case described above.

rdar://139840307
2024-12-02 15:36:00 -08:00
Erik Eckstein
15ead8aa48 tests: fix a wrong check line in SILOptimizer/large_string_array.swift.gyb
Triggered by https://github.com/swiftlang/swift/pull/77806
rdar://140778726
2024-12-02 19:26:39 +01:00
Erik Eckstein
c6408387a7 tests: add a missing -sil-print-types in validation-test/SILOptimizer/rdar114699006.swift
rdar://140405972
2024-11-22 14:32:52 +01:00
Daniel Rodríguez Troitiño
6b27d33596 [validation-test] Add missing REQUIRES: macosx-x86_64 to test (#77357)
This test forces the usage of macosx-x86_64 and will fail if the x86_64
slice of the stdlib has not been built. Mark it as only running on
macosx-x86_64 to avoid the test failure in that case.
2024-11-02 19:00:22 -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
Nate Chandler
350aaa4d39 [Test] Mark unsupported for OS stdlib.
The test verifies a stdlib behavior whose fix is not present in all
OSes.

rdar://136943907
2024-09-30 07:14:54 -07:00
Erik Eckstein
60e7346b87 tests: re-enable SILOptimizer/string_switch.swift
And fix the check lines.

(the test was disabled in https://github.com/swiftlang/swift/pull/76592)

rdar://136304425
2024-09-20 09:30:30 +02:00
Mishal Shah
5fb9583f0c Merge pull request #76592 from nate-chandler/rdar136304425
[Test] Disable test blocking Linux PR testing.
2024-09-19 21:24:17 -07:00
Nate Chandler
9b00df3ba0 [Test] Disable test blocking Linux PR testing.
rdar://136304425
2024-09-19 17:37:39 -07:00
Nate Chandler
653d7b36e0 [Test] Add regression test.
For rdar://136267186 .
2024-09-19 11:29:13 -07:00
Erik Eckstein
6c46d03601 tests: reduce the timeout of SILOptimizer/large_nested_array.swift.gyb again
It turns out that some CI jobs need 5-6 minutes for this test. To give some slack, use a timeout of 10 minutes.

This is a follow-up of https://github.com/swiftlang/swift/pull/76146
2024-09-03 09:26:31 +02:00
nate-chandler
9ee877943e Merge pull request #76186 from nate-chandler/rdar133779160
[ODL] Handle builtins.
2024-08-30 21:54:08 -07:00
Nate Chandler
5d9802f25f [ODL] Handle builtins.
No update is needed for the values they produce.  This pass should
really be refactored not to crash on instructions that aren't explicitly
listed or at least not to compile if not every instruction is listed.

rdar://133779160
2024-08-30 16:09:11 -07:00
Mike Ash
eead3fa921 [Test] Temporarily increase large_nested_array.swift.gyb timeout to 2400 seconds while we investigate timeouts in CI. 2024-08-29 09:07:52 -04:00
nate-chandler
c56a313d6c Merge pull request #76114 from nate-chandler/rdar133969821_2
[DAH] Bail on pointer use if ignoring barriers.
2024-08-27 21:57:39 -07:00