Meghana Gupta
470fa2f365
Remove resultDependsOn/resultDependsOnSelf
2024-06-05 11:36:16 -07:00
Ellie Shin
6216ec648f
Merge pull request #73902 from apple/elsh/pkg-cmo-inline
...
[SIL][PackageCMO] Allow optimizing [serialized_for_pkg] functions
2024-06-04 11:39:19 -07:00
Emil Pedersen
531469f70e
Merge pull request #73864 from Snowy1803/scs-builder-skip-meta
...
Skip meta instructions for Builder.init with automatic location
2024-05-30 09:50:48 -07:00
Ellie Shin
c3ded85c4f
Update SILBridgedFunction APIs.
...
Add isAnySerialized() and canBeInlinedIntoCaller(SerializedKind).
2024-05-29 15:54:36 -07:00
Emil Pedersen
d39d838c2b
Skip meta instructions for Builder.init with automatic location
2024-05-24 16:01:11 -07:00
Emil Pedersen
4b1ce86f48
Add Location.isInlined to SwiftCompilerSources
2024-05-23 16:04:05 -07:00
Kshitij Jain
64da348ee9
Merge pull request #73688 from jkshtj/main
...
[Autodiff] Adds logic to rewrite call-sites using functions specialized by the closure-spec optimization
2024-05-23 14:21:31 -07:00
Kshitij
487648a3aa
[Autodiff] Fixes bugs in closure-spec opt that were causing "optimized" test failures on Linux builds
2024-05-22 22:24:31 -07:00
Andrew Trick
b88566a36c
Merge pull request #73621 from atrick/fix-access-mark-uninit
...
Allow AddressUseDefWalker to continue past MarkUninitializedInst
2024-05-22 18:18:51 -07:00
Kshitij
c288d95c1e
[Autodiff] Separates out changes for using non-ossa instructions in the closure-spec optimization pass
...
The OSSA elimination pass has not yet been moved below all high level
function passes. Until that work has been completed the Autodiff
closure-spec optimization pass cannot solely support OSSA instructions.
2024-05-21 12:02:28 -07:00
Kshitij
12faf79911
[Autodiff] Adds logic to rewrite call-sites using functions specialized by the closure-spec optimization
2024-05-21 12:02:28 -07:00
Erik Eckstein
941a7427d8
handle upcast instructions in statically initialized globals
...
This allows statically initialized multi-dimensional arrays in embedded swift.
2024-05-21 13:33:06 +02:00
eeckstein
55a2a412dc
Merge pull request #73706 from eeckstein/object-outliner-improvement
...
ObjectOutliner: try outline alloc_refs in multiple iterations to handle multi-dimensional arrays
2024-05-21 09:05:15 +02:00
Erik Eckstein
ccc691cc42
ObjectOutliner: try outline alloc_refs in multiple iterations to handle multi-dimensional arrays
...
This allows to completely statically allocate multi-dimensional global arrays, like
```
var x = [[1, 2], [3, 4], [5, 6]]
```
2024-05-17 17:03:07 +02:00
Erik Eckstein
cd59a5e1d0
SimplifyCheckedCast: only simplify if source and destination address types match
...
Fixes a crash when creating a copy_addr with mismtaching types.
rdar://128195403
2024-05-17 15:07:40 +02:00
Erik Eckstein
af68435d90
Optimizer: support static initialization of global arrays
...
The buffer of global arrays could already be statically initialized.
The missing piece was the array itself, which is basically a reference to the array buffer.
For example:
```
var a = [1, 2, 3]
```
ends up in two statically initialized globals:
1. the array buffer, which contains the elements
2. the variable `a` which is a single reference (= pointer) of the array buffer
This optimization removes the need for lazy initialization of such variables.
rdar://127757554
2024-05-16 21:34:36 +02:00
Erik Eckstein
cc78c8f094
Optimizer: add Context.canMakeStaticObjectReadOnly API
2024-05-16 21:34:35 +02:00
Erik Eckstein
d9fc62e54a
SimplifyKeyPath: remove dead keypath instructions also in non-OSSA
...
which means: handle of strong_release instructions
2024-05-16 09:32:08 +02:00
Kshitij Jain
c37d31cc64
Merge pull request #73596 from jkshtj/specialize
...
[Autodiff] Adds logic to generate specialized functions in the closure-spec pass
2024-05-14 18:55:23 -07:00
nate-chandler
4cf63a9394
Merge pull request #73576 from nate-chandler/gardening/20240510/1
...
[Gardening] SIL: Spelling of live range.
2024-05-14 15:50:08 -07:00
Andrew Trick
dfe62b442e
Allow AddressUseDefWalker to continue past MarkUninitializedInst.
...
This makes SwiftCompilerSources address/access utilities consistent with C++ and
allows them to be used in diagnostic passes.
2024-05-14 10:31:24 -07:00
Andrew Trick
1ac4b4dd9d
[SwiftCompilerSources] Add swift_get_access_base unit tests.
...
Add a unit test harness to SwiftCompilerSources to match the one in C++ since
both source bases have different implementations of the same utilities, and they
must be consistent for correctness.
2024-05-14 10:31:24 -07:00
Kshitij
ce2161ee43
[Autodiff] Fixes build issues on Linux
2024-05-13 19:25:18 -07:00
Kshitij
74166a4ab6
[Autodiff] Moves bridging code accesses in closure-spec opt behind APIs
...
Addresses some other surfacial feedback as well.
2024-05-13 15:37:30 -07:00
Kshitij
ab751d57ab
[Autodiff] Adds logic to generate specialized functions in the closure-spec pass
2024-05-13 11:16:42 -07:00
Erik Eckstein
4b2973a43c
ComputeSideEffects: correctly handle escaping arguments
...
If an argument escapes in a called function, we don't know anything about the argument's side effects.
For example, it could escape to the return value and effects might occur in the caller.
Fixes a miscompile
https://github.com/apple/swift/issues/73477
rdar://127691335
2024-05-13 18:27:49 +02:00
Nate Chandler
7bfd7110cc
[Gardening] SIL: "LifeRange" -> "LiveRange"
2024-05-10 15:56:35 -07:00
Nate Chandler
71368be8d4
[Gardening] SIL: "Liferange" -> "Liverange"
2024-05-10 15:54:09 -07:00
Nate Chandler
87e4c65e28
[Gardening] SIL: "liferange" -> "liverange"
2024-05-10 15:54:07 -07:00
Kshitij Jain
01654fd323
Merge pull request #71775 from jkshtj/main
...
[Autodiff] Adds part of the Autodiff specific closure-specialization optimization pass
2024-05-10 08:51:01 -07:00
Nate Chandler
c84e196b16
[Test] Reenable SIL unit tests on windows.
...
Use `fflush(stdout)` from C++.
Issue 73252.
2024-05-06 12:20:16 -07:00
Nate Chandler
06921cfe84
[SIL] Hollow out Builtin.copy, deprecate _copy.
...
The copy operator has been implemented and doesn't use it. Remove
`Builtin.copy` and `_copy` as much as currently possible.
Source compatibility requires that `_copy` remain in the stdlib. It is
deprecated here and just uses the copy operator.
Handling old swiftinterfaces requires that `Builtin.copy` be defined.
Redefine it here as a passthrough--SILGen machinery will produce the
necessary copy_addr.
rdar://127502242
2024-05-03 15:56:25 -07:00
Kshitij
c6330a7d3f
Rev: Addressed feedback
2024-05-02 13:16:12 -07:00
Kshitij
fd609846ae
Makes the swift-based closure-spec pass an experimental frontend feature
2024-05-02 09:14:05 -07:00
Kshitij
c8375c06ae
[Autodiff] Adds part of the closure-specialization optimization pass
...
Changes in this CR add part of the, Swift based, Autodiff specific
closure specialization optimization pass. The pass does not modify any
code nor does it even exist in any of the optimization pipelines. The
rationale for pushing this partially complete optimization pass upstream
is to keep up with the breaking changes in the underlying Swift based
compiler infrastructure.
2024-05-02 09:14:05 -07:00
Kshitij
003c9082cb
[Autodiff] Adds SwiftCompilerSources changes in preparation for the Autodiff closure-spec optimization pass
2024-05-02 09:14:05 -07:00
eeckstein
7bf193e764
SwiftCompilerSources: workaround a compiler crash on windows by disabling convert_function simplification
2024-04-29 10:52:25 +02:00
eeckstein
87a520ccb2
SwiftCompilerSources: exclude some low level file operations, which are not compilable on windows
2024-04-29 10:52:25 +02:00
Erik Eckstein
0c8c98523e
SwiftCompilerSources: remove a not needed import CxxStdlib
...
It's not needed and doesn't work on Windows
2024-04-29 10:52:25 +02:00
Kuba Mracek
33e89c0aad
[embedded] Consider move_value/copy_value as removable for keypath optimization
2024-04-22 13:33:24 -07:00
Andrew Trick
1e94a6e91e
Merge pull request #73015 from atrick/fix-enum-local
...
LocalVariableUtils: add support for temporary enum initialization.
2024-04-13 10:17:24 -07:00
Andrew Trick
fc60925a38
LocalVariableUtils: add support for temporary enum initialization.
2024-04-12 14:11:37 -07:00
nate-chandler
7bcedc91da
Merge pull request #72992 from nate-chandler/simplify-tuple
...
[OnoneSimplify] Handle tuple(destructure_tuple()).
2024-04-12 09:09:36 -07:00
Nate Chandler
5004e93144
[OnoneSimplify] Handle tuple(destructure_tuple()).
2024-04-11 15:20:41 -07:00
eeckstein
e871ae40c5
Merge pull request #71176 from eeckstein/borrowed-from-instruction
...
SIL: add the borrowed-from instruction
2024-04-10 19:33:12 +02:00
Joe Groff
e06ff61312
Merge pull request #72577 from jckarter/enable-borrowing-switch-backend
...
Use the `BorrowingSwitch` implementation for all noncopyable switches.
2024-04-10 07:38:12 -07:00
Erik Eckstein
e14c1d1f62
SIL, Optimizer: update and handle borrowed-from instructions
...
Compute, update and handle borrowed-from instruction in various utilities and passes.
Also, used borrowed-from to simplify `gatherBorrowIntroducers` and `gatherEnclosingValues`.
Replace those utilities by `Value.getBorrowIntroducers` and `Value.getEnclosingValues`, which return a lazily computed Sequence of borrowed/enclosing values.
2024-04-10 13:38:10 +02:00
Erik Eckstein
3c368575b4
SwiftCompilerSources: add a few utility APIs
2024-04-10 13:38:10 +02:00
Erik Eckstein
f9015e0e11
SIL: fix BorrowedValue initializer for non-guaranteed function args
2024-04-10 13:38:10 +02:00
Erik Eckstein
ac4bc89c9a
SIL: add the borrowed-from instruction.
...
It declares from which enclosing values a guaranteed phi argument is borrowed from.
2024-04-10 13:38:10 +02:00