profile
viewpoint

meg-gupta/ChakraCore 0

ChakraCore is the core part of the Chakra Javascript engine that powers Microsoft Edge

meg-gupta/swift 0

The Swift Programming Language

meg-gupta/swift-source-compat-suite 0

The infrastructure and project index comprising the Swift source compatibility suite.

PR opened apple/swift

[ownership] Add a new ReborrowVerifier

This updates how we model reborrow's lifetimes for ownership verification. Today we follow and combine a borrow's lifetime through phi args as well. Owned values lifetimes end at a phi arg. This discrepency in modeling lifetimes leads to the OwnershipVerifier raising errors incorrectly for cases such as this, where the borrow and the base value do not dominate the end_borrow:

bb0:
  cond_br undef, bb1, bb2
bb1:
  %copy0 = copy_value %0
  %borrow0 = begin_borrow %copy0
  br bb3(%borrow0, %copy0)
bb2:
  %copy1 = copy_value %1
  %borrow1 = begin_borrow %copy1
  br bb3(%borrow1, %copy1)
bb3(%borrow, %baseVal):
  end_borrow %borrow
  destroy_value %baseVal

This PR adds a new ReborrowVerifier. The ownership verifier collects borrow's lifetime ending users and populates the worklist of the ReborrowVerifier with reborrows and the corresponding base value. ReborrowVerifier then verifies that the lifetime of the reborrow is within the lifetime of the base value.

+1358 -283

0 comment

14 changed files

pr created time in 30 minutes

push eventmeg-gupta/swift

Meghana Gupta

commit sha 76c1790eac801757d5670b968759dc220c46635d

Use a cache to check for guaranteed phi args without lifetime ending uses

view details

push time in 40 minutes

push eventmeg-gupta/swift

Meghana Gupta

commit sha 30c8de4ba16c3b82487dce4c662b6173de305174

Use a cache to check for guaranteed phi args without lifetime ending uses

view details

push time in 41 minutes

create barnchmeg-gupta/swift

branch : reborrowverifier

created branch time in 10 hours

push eventmeg-gupta/swift

Varun Gandhi

commit sha be109b72a576799a018dba368c8495d5a9f0d6e7

[AST] Add method to check if a function type has a non-trivial Clang type.

view details

Slava Pestov

commit sha 548b96a9ff48861a99d7251648f48e3eb8d90d25

Sema: Add documentation comments for ExportContext

view details

Slava Pestov

commit sha d579b697f6c104cf4f7469ca6b0081193c6e2347

Sema: Teach ExportContext to compute whether we're inside a deprecated declaration

view details

Slava Pestov

commit sha 78d2cf2ee945031e0113056d4ea221b3ce772ccb

Sema: Teach ExportContext to compute whether we're inside an implicit declaration

view details

Slava Pestov

commit sha 85d24953de5c14eb83e4c8492bacd2eef4869986

Sema: Teach ExportContext to compute whether we're inside an unavailable declaration

view details

Saleem Abdulrasool

commit sha 74144e4788135649280b134cc260959228e2b6eb

Platform: extract `WLANAPI` module on Windows The WLAN APIs are used for the native WiFi implementation and is not as generally useful. Extract it into a submodule.

view details

Meghana Gupta

commit sha 0044e7dcac6ff176be0945ba0f468967979779d3

[ownership] Move OME past SILMem2Reg

view details

Doug Gregor

commit sha e1852956a065bdeca503c28fec37b3de139f8010

[Concurrency] Drop "get" prefix when importing Objective-C methods as async. Implements rdar://70506634.

view details

Andrew Trick

commit sha b0bda135430ea5bccd471946f850a114aaf8521d

LoadBorrowInvalidation: fix mysteriously inverted boolean returns.

view details

Andrew Trick

commit sha 4f05d8a857f08b42c0def949fe37c99d4131be49

LoadBorrowImmutabilityChecker renaming. Limit names to a straightforward and unambiguous statement of purpose. They should not pose additional questions which can only be answered by reading the code. Nuanced meaning belongs in descriptions and code comments. These are all examples that legitimately made reading the code very difficult for me: - LoadBorrowInvalidationChecker: what does "invalidation" mean in this context? How does that extend the meaning of "checker"? How can something ever pass a checker and not be invalid? - constructValuesForKey outside of an ADT does not state purpose at all. - wellBehavedWriteAccumulator: Raises questions about what writes are included and the broader semantics of the parent function. It turns out that well-behavedness is handled by the function's return value and has nothing to do with the accumulator.

view details

Slava Pestov

commit sha be73343f359b17d25d1978910806bd8c10802048

Merge pull request #34372 from slavapestov/more-export-context-refactoring Generalize ExportContext and use it for deprecation and unavailability

view details

Andrew Trick

commit sha 8e3fb44f2d7981fa443c45386342eeb8cdefb440

Rewrite LoadBorrowImmutabilityChecker using AccessPath. The verification will now be as complete as it can be within the capability of our SIL utilities. It is much more aggressive with respect to boxes, references, and pointers. It's more efficient in that it only considers "overlapping" uses. It is also now wholly consistent with the utilities that it uses, so can be reenabled. We could probably go even further and remove the switch statement entirely, relying on AccessPath to recognize any operations that propagate addresses, boxes, or pointers. But I didn't want to potentially weaken enforcement without more careful consideration.

view details

Andrew Trick

commit sha 0f1beedfb7cb62a8e9c8969152615593a382877e

Reenable load-borrow checker.

view details

Varun Gandhi

commit sha 987d055b8c69347a4cd8533d7b59c7ceaccee0fe

[Mangler] Handle mangling for Clang types not derivable from Swift types.

view details

Varun Gandhi

commit sha 6cb71c6b457d17b16046d56777fe378b22c8d8bb

[ASTPrinter] Print Clang type only if not derivable from Swift type.

view details

Nate Chandler

commit sha 97202faee50f20d1e86be9205b87ca8b801cd342

[Async CC] Put direct returns after indirect returns. For callers who do not know the actual type of the called function, e.g. when the called function is the result of a partial apply, the offset to the direct returns would otherwise not be known.

view details

Nate Chandler

commit sha a9aee1b9ddbba56a27de3a604cecefb17ed042a5

[Async CC] Put bindings after formal arguments. Bindings will always be supplied by the first partial apply, so they will only be added to the async context when its full layout is known. If they are earlier in the layout, subsequent partial applies will put their arguments into the wrong position because they will not be privy to the space requirements of the bindings.

view details

Nate Chandler

commit sha 409f3d253b4f09de15722b4f08d65e7b60f9b461

[NFC] Removed Explosion::peek. The convenience was added to aid with the async calling convention but it has proven to be unnecessary. Here, it is removed.

view details

Nate Chandler

commit sha 0356c9f4c009daea16595a39690be335c70f2367

[NFC] Simplify saving of self to async context.

view details

Nate Chandler

commit sha 63b5ba457e5a36e890fd4846fc9ec0f2b638259c

[NFC] Used consistent style for casting.

view details

push time in 2 days

PullRequestReviewEvent

push eventmeg-gupta/swift

Meghana Gupta

commit sha ce5e94f3c3d63ca277615c35437424b84de99ff3

SILVerifier: async functions can be called from async functions only

view details

push time in 4 days

push eventmeg-gupta/swift

Meghana Gupta

commit sha a71c7bbda1fa6534cbb76aca0f740caba0608548

SILVerifier: async functions can be called from async functions only

view details

push time in 4 days

push eventmeg-gupta/swift

Meghana Gupta

commit sha 1651470b27bed4f6df45666f4a5e63f02adb9b19

SILVerifier: async functions can be called from async functions only

view details

push time in 4 days

create barnchmeg-gupta/swift

branch : asyncverify

created branch time in 4 days

push eventmeg-gupta/swift

Varun Gandhi

commit sha be109b72a576799a018dba368c8495d5a9f0d6e7

[AST] Add method to check if a function type has a non-trivial Clang type.

view details

Slava Pestov

commit sha 548b96a9ff48861a99d7251648f48e3eb8d90d25

Sema: Add documentation comments for ExportContext

view details

Slava Pestov

commit sha d579b697f6c104cf4f7469ca6b0081193c6e2347

Sema: Teach ExportContext to compute whether we're inside a deprecated declaration

view details

Slava Pestov

commit sha 78d2cf2ee945031e0113056d4ea221b3ce772ccb

Sema: Teach ExportContext to compute whether we're inside an implicit declaration

view details

Slava Pestov

commit sha 85d24953de5c14eb83e4c8492bacd2eef4869986

Sema: Teach ExportContext to compute whether we're inside an unavailable declaration

view details

Saleem Abdulrasool

commit sha 74144e4788135649280b134cc260959228e2b6eb

Platform: extract `WLANAPI` module on Windows The WLAN APIs are used for the native WiFi implementation and is not as generally useful. Extract it into a submodule.

view details

Meghana Gupta

commit sha 0044e7dcac6ff176be0945ba0f468967979779d3

[ownership] Move OME past SILMem2Reg

view details

Doug Gregor

commit sha e1852956a065bdeca503c28fec37b3de139f8010

[Concurrency] Drop "get" prefix when importing Objective-C methods as async. Implements rdar://70506634.

view details

Andrew Trick

commit sha b0bda135430ea5bccd471946f850a114aaf8521d

LoadBorrowInvalidation: fix mysteriously inverted boolean returns.

view details

Andrew Trick

commit sha 4f05d8a857f08b42c0def949fe37c99d4131be49

LoadBorrowImmutabilityChecker renaming. Limit names to a straightforward and unambiguous statement of purpose. They should not pose additional questions which can only be answered by reading the code. Nuanced meaning belongs in descriptions and code comments. These are all examples that legitimately made reading the code very difficult for me: - LoadBorrowInvalidationChecker: what does "invalidation" mean in this context? How does that extend the meaning of "checker"? How can something ever pass a checker and not be invalid? - constructValuesForKey outside of an ADT does not state purpose at all. - wellBehavedWriteAccumulator: Raises questions about what writes are included and the broader semantics of the parent function. It turns out that well-behavedness is handled by the function's return value and has nothing to do with the accumulator.

view details

Slava Pestov

commit sha be73343f359b17d25d1978910806bd8c10802048

Merge pull request #34372 from slavapestov/more-export-context-refactoring Generalize ExportContext and use it for deprecation and unavailability

view details

Andrew Trick

commit sha 8e3fb44f2d7981fa443c45386342eeb8cdefb440

Rewrite LoadBorrowImmutabilityChecker using AccessPath. The verification will now be as complete as it can be within the capability of our SIL utilities. It is much more aggressive with respect to boxes, references, and pointers. It's more efficient in that it only considers "overlapping" uses. It is also now wholly consistent with the utilities that it uses, so can be reenabled. We could probably go even further and remove the switch statement entirely, relying on AccessPath to recognize any operations that propagate addresses, boxes, or pointers. But I didn't want to potentially weaken enforcement without more careful consideration.

view details

Andrew Trick

commit sha 0f1beedfb7cb62a8e9c8969152615593a382877e

Reenable load-borrow checker.

view details

Varun Gandhi

commit sha 987d055b8c69347a4cd8533d7b59c7ceaccee0fe

[Mangler] Handle mangling for Clang types not derivable from Swift types.

view details

Varun Gandhi

commit sha 6cb71c6b457d17b16046d56777fe378b22c8d8bb

[ASTPrinter] Print Clang type only if not derivable from Swift type.

view details

Nate Chandler

commit sha 97202faee50f20d1e86be9205b87ca8b801cd342

[Async CC] Put direct returns after indirect returns. For callers who do not know the actual type of the called function, e.g. when the called function is the result of a partial apply, the offset to the direct returns would otherwise not be known.

view details

Nate Chandler

commit sha a9aee1b9ddbba56a27de3a604cecefb17ed042a5

[Async CC] Put bindings after formal arguments. Bindings will always be supplied by the first partial apply, so they will only be added to the async context when its full layout is known. If they are earlier in the layout, subsequent partial applies will put their arguments into the wrong position because they will not be privy to the space requirements of the bindings.

view details

Nate Chandler

commit sha 409f3d253b4f09de15722b4f08d65e7b60f9b461

[NFC] Removed Explosion::peek. The convenience was added to aid with the async calling convention but it has proven to be unnecessary. Here, it is removed.

view details

Nate Chandler

commit sha 0356c9f4c009daea16595a39690be335c70f2367

[NFC] Simplify saving of self to async context.

view details

Nate Chandler

commit sha 63b5ba457e5a36e890fd4846fc9ec0f2b638259c

[NFC] Used consistent style for casting.

view details

push time in 4 days

push eventmeg-gupta/swift

push time in 4 days

push eventmeg-gupta/swift

Meghana Gupta

commit sha 75ee09c041a9530240efe70493f167c449343866

Update LinearLifetimeChecker to allow nonConsumingUse and consumingUse to be on the same TermInst

view details

Meghana Gupta

commit sha f0b19d1d7772808de37557203b54a0117da7ed68

Add ReborrowVerifier

view details

Meghana Gupta

commit sha 5e6b81a4c0a6bd8ff91160cd87e3ee7c13502d7c

Update for chain of reborrows

view details

Meghana Gupta

commit sha 5c4e8ed0692fa915364a8305dd5ad46c87e9140f

t

view details

push time in 4 days

push eventmeg-gupta/swift

Butta

commit sha 69d04aad08da3245f87c6a2df35869126d48b55e

[linux] remove absolute rpath of /usr/lib/swift/linux added to many shared libraries This was presumably added as a backup, in case the libraries in a toolchain couldn't be found, but will not work well, so take it out.

view details

Alexey Komnin

commit sha 4fa17bf59774ae6543a33b1a29f01320705f4dfe

SR-12022: refactor LiteralExpr to combine common initializer code

view details

Michael Gottesman

commit sha d3e6ffdbad9ed2af857508891a4530b7f11d4c6e

[lldb-toolbox] Add the ability to disassemble-to-file a specific function from a target without running the target. The routine already supports dumping the assembly to file if we are at a breakpoint using the current frame. This adds a -n option so one can without running just dump the assembly to a file of a specific function in a binary.

view details

Dave Lee

commit sha 27330f169df5d2dcb018ab2c6615d66be91d04e2

[build] Remove unused lldb cmake

view details

Keith Smiley

commit sha ae0c380f1b0f37e11b111a06634dd4c64e67b96c

Improve -*prefix-map help text Before: ``` -coverage-prefix-map <value> -debug-prefix-map <value> ``` After: ``` -coverage-prefix-map <prefix=replacement> -debug-prefix-map <prefix=replacement> ```

view details

Mike Ash

commit sha 630aff7b19b80f29445b645424e20fd1bb6bd551

[Runtime] Change SimpleGlobalCache to use ConcurrentReadableHashMap instead of ConcurrentMap. This gives us faster lookups and a small advantage in memory usage. Most of these maps need stable addresses for their entries, so we add a level of indirection to ConcurrentReadableHashMap for these cases to accommodate that. This costs some extra memory, but it's still a net win. A new StableAddressConcurrentReadableHashMap type handles this indirection and adds a convenience getOrInsert to take advantage of it. ConcurrentReadableHashMap is tweaked to avoid any global constructors or destructors when using it as a global variable. ForeignWitnessTables does not need stable addresses and it now uses ConcurrentReadableHashMap directly. rdar://problem/70056398

view details

Alexis Laferrière

commit sha e61ffea42c943044fe4fc8c35d5040bc8815e420

[Sema] Check availability in inlinable code using the explicit version Inlinable functions can be inlined in clients with a lower OS target version than the framework defining the function. For this reason, the availability in inlinable functions should always be checked using the explicit introduction OS version as lower bound and not the minimum deployment version. rdar://problem/67975153

view details

Alexis Laferrière

commit sha 53e04cb39db86d890ff674b775a5dbda47e9d599

[Sema] Test explicit versions in TypeRefinementContext

view details

Alexis Laferrière

commit sha 2f182c2b785f5f7b68ee756d1474f21f3050ba67

[Sema] Consider unavailable functions as being unreachable This has the effect of rejecting unavailable overrides to available methods in a similar way as overrides that are less available than the introduction are rejected.

view details

Alexis Laferrière

commit sha 39ee5916bd656cf56c75ddf45a47e628d0ff1db1

[SIL] Don't print availability for unreachable/unavailable functions

view details

Martin Boehme

commit sha a5e953b69009b59541420d06496206a26961a976

Add support for calling C++ constructors. Because C++ constructors always take a `this` pointer to the object to be initialized, we mark the SIL function return type with the `@out` attribute. On the IRGen side, we retrofit support for formal indirect return values as well as thin metatypes.

view details

Martin Boehme

commit sha 7ad2eef26508ad92d8d92f2d5546913c0ced3bbd

Only import constructors marked `noexcept`.

view details

Martin Boehme

commit sha 384854810a60a69c8df8a8c0248e209adc28c295

Revert "Only import constructors marked `noexcept`." This reverts commit 29650d8c1f302708a32304d49c703c9ddbf30b75. As discussed here, we want to import all constructors (whether they are marked `noexcept` or not) as non-throwing initializers; https://forums.swift.org/t/handling-c-exceptions/34823/50

view details

Martin Boehme

commit sha fd00bc1f01357ecd264b8216373c23014771c124

Move tests from `CXXInterop` to `Interop/Cxx`. This is the canonical location that we've agreed on.

view details

Martin Boehme

commit sha e6067275a6659cfab8640e68e93a5bba36ddca20

Duplicate changes to GenClangType in ClangTypeConverter. See discussion here: https://github.com/apple/swift/pull/30630#discussion_r398967412

view details

Martin Boehme

commit sha b2c5a3eeed4e0d80c819f98c816481fbedc49526

Add a constructor thunk if required to add additional constructor arguments. Also add more IR tests and make various other changes.

view details

Martin Boehme

commit sha 3066e16c37e26a5fea370877409b4d0bd1c0fea6

Remove redundant "cxx" from test names.

view details

Martin Boehme

commit sha 5644137ea0696164c5b5835179b1ec450d508c88

Eliminate duplication of code for adding empty argument names.

view details

Martin Boehme

commit sha bed26039446c189a82c453126e0a622e43c6256d

Various changes after merging master: - Adapt tests to changes that have happened in the meantime (e.g. `HasVirtualBase` is rightly no longer considered loadable) - Don't import copy or move constructors (noticed this because references are now imported correctly, so copy and move constructors suddenly started showing up in the SIL test) - Don't try to define an implicitly-deleted default constructor (this previously broke loadable-types-silgen.swift)

view details

Martin Boehme

commit sha beaaa742c3e774b6739de26bb1a3f0c8761512a5

Don't put an `sret` attribute on the `this` argument.

view details

push time in 4 days

push eventapple/swift

Meghana Gupta

commit sha 0044e7dcac6ff176be0945ba0f468967979779d3

[ownership] Move OME past SILMem2Reg

view details

Meghana Gupta

commit sha 8145566b7d72834b8e29eebe4f275d1c8d4411c0

Merge pull request #34380 from meg-gupta/moveomepastmem2reg [ownership] Move OME past SILMem2Reg

view details

push time in 5 days

PR merged apple/swift

[ownership] Move OME past SILMem2Reg
+3 -3

4 comments

1 changed file

meg-gupta

pr closed time in 5 days

pull request commentapple/swift

[ownership] Move OME past SILMem2Reg

@swift-ci benchmark

meg-gupta

comment created time in 5 days

pull request commentapple/swift

[ownership] Move OME past SILMem2Reg

@swift-ci test source compatibility

meg-gupta

comment created time in 5 days

pull request commentapple/swift

[ownership] Move OME past SILMem2Reg

@swift-ci test

meg-gupta

comment created time in 5 days

PR opened apple/swift

[ownership] Move OME past SILMem2Reg
+3 -3

0 comment

1 changed file

pr created time in 5 days

create barnchmeg-gupta/swift

branch : moveomepastmem2reg

created branch time in 5 days

push eventmeg-gupta/swift

Butta

commit sha 69d04aad08da3245f87c6a2df35869126d48b55e

[linux] remove absolute rpath of /usr/lib/swift/linux added to many shared libraries This was presumably added as a backup, in case the libraries in a toolchain couldn't be found, but will not work well, so take it out.

view details

Martin Boehme

commit sha a5e953b69009b59541420d06496206a26961a976

Add support for calling C++ constructors. Because C++ constructors always take a `this` pointer to the object to be initialized, we mark the SIL function return type with the `@out` attribute. On the IRGen side, we retrofit support for formal indirect return values as well as thin metatypes.

view details

Martin Boehme

commit sha 7ad2eef26508ad92d8d92f2d5546913c0ced3bbd

Only import constructors marked `noexcept`.

view details

Martin Boehme

commit sha 384854810a60a69c8df8a8c0248e209adc28c295

Revert "Only import constructors marked `noexcept`." This reverts commit 29650d8c1f302708a32304d49c703c9ddbf30b75. As discussed here, we want to import all constructors (whether they are marked `noexcept` or not) as non-throwing initializers; https://forums.swift.org/t/handling-c-exceptions/34823/50

view details

Martin Boehme

commit sha fd00bc1f01357ecd264b8216373c23014771c124

Move tests from `CXXInterop` to `Interop/Cxx`. This is the canonical location that we've agreed on.

view details

Martin Boehme

commit sha e6067275a6659cfab8640e68e93a5bba36ddca20

Duplicate changes to GenClangType in ClangTypeConverter. See discussion here: https://github.com/apple/swift/pull/30630#discussion_r398967412

view details

Martin Boehme

commit sha b2c5a3eeed4e0d80c819f98c816481fbedc49526

Add a constructor thunk if required to add additional constructor arguments. Also add more IR tests and make various other changes.

view details

Martin Boehme

commit sha 3066e16c37e26a5fea370877409b4d0bd1c0fea6

Remove redundant "cxx" from test names.

view details

Martin Boehme

commit sha 5644137ea0696164c5b5835179b1ec450d508c88

Eliminate duplication of code for adding empty argument names.

view details

Martin Boehme

commit sha bed26039446c189a82c453126e0a622e43c6256d

Various changes after merging master: - Adapt tests to changes that have happened in the meantime (e.g. `HasVirtualBase` is rightly no longer considered loadable) - Don't import copy or move constructors (noticed this because references are now imported correctly, so copy and move constructors suddenly started showing up in the SIL test) - Don't try to define an implicitly-deleted default constructor (this previously broke loadable-types-silgen.swift)

view details

Martin Boehme

commit sha beaaa742c3e774b6739de26bb1a3f0c8761512a5

Don't put an `sret` attribute on the `this` argument.

view details

Martin Boehme

commit sha 8416ccfa06d05da67af70a8ed57a2f120ea251b2

Rename constructors-ir.swift to constructors-irgen.swift.

view details

Martin Boehme

commit sha 8f6042aa0870a527505262c7dbe89ec7ffe20e12

Add additional IR tests for a class without a virtual base class.

view details

Martin Boehme

commit sha c9405fb7fc338f59db4386488245a3ce82227e00

Add Windows-name-mangled version of symbol to SIL test.

view details

Martin Boehme

commit sha cb4ddda6e2292c584cb83905f3f9df17a4e017f1

Avoid crashing if lldb imports C++ structs without enabling C++ interop.

view details

Martin Boehme

commit sha 33e8c717f2682b913eb04e1c7746c84315be90ef

Update comment in VisitCXXRecordDecl().

view details

Martin Boehme

commit sha 7e8ea120701b33958a1adca9e885a99f5d583607

Respond to review comments.

view details

Martin Boehme

commit sha 1ce3753d08522cefe255f4acf498dba5085aa60a

Another response to review comments.

view details

Martin Boehme

commit sha faca489c6f524096019fd124cba847949972e0db

Add a test that Objective-C types passed to a C++ constructor are bridged correctly.

view details

Martin Boehme

commit sha 83b51b95b534108494de1032bb4e098274fe606b

Add SILGen and IRGen tests for passing Objective-C types to C++ constructors.

view details

push time in 5 days

push eventapple/swift

Meghana Gupta

commit sha 7cea31ba3c055ca316b344b3ca8eff8f35a5baa1

SILMem2Reg: Don't add dead values as phi arguments A dealloc_stack ends the lifetime of an alloc_stack on a path. We don't have to pass RunningVal beyond the dealloc_stack as phi argument to the post dominating block.

view details

Meghana Gupta

commit sha eff6b66906f094026afe1a61dae44d4eeba2709b

Add hasOwnership assertion in SILBuilder while creating unchecked_value_cast

view details

Meghana Gupta

commit sha 83474707eea654d81bc49565f952c84cc19508c9

Enable SILMem2Reg for OSSA SILMem2Reg has roughly 2 central algorithms, removal of alloc_stack with uses in a single block vs multiple blocks. While replacing loads and stores to the stack location in each of the 2 algorithms, new handling of qualifiers like [assign], [copy] and [take] which are new to OSSA are needed. Also Disable SILMem2Reg when we see this pattern: load [take] (struct_element_addr/tuple_element_addr %ASI) Convert SILMem2Reg tests into ossa And add new SILMem2Reg tests for non-trivial values. Thanks to zoecarver for additional tests.

view details

Meghana Gupta

commit sha 0ea5d055a20e2066ba1e034d52b1dead007a4dab

Delete debug_value_addr of stack location, if a debug_value of the RunningVal is already found

view details

Meghana Gupta

commit sha 06eaf6bba4de85631c532cb9bb9cd232758706c4

Disable SILCombine of unchecked_bitwise_cast to unchecked_ref_cast in OSSA unchecked_ref_cast is a forwarding cast while unchecked_bitwise_cast is not. We cannot just convert one to other in OSSA. Disable it now.

view details

Meghana Gupta

commit sha a79043928e6a2cf50fbf3229a59eccdeccf42621

Merge pull request #34276 from meg-gupta/mem2regossa [ownership] Enable SILMem2Reg for OSSA

view details

push time in 5 days

PR merged apple/swift

[ownership] Enable SILMem2Reg for OSSA

SILMem2Reg is currently not enabled for OSSA. This PR enables it for OSSA, and adds support for composite loads and stores with ownership qualifiers [copy], [assign] and [take] that are new to OSSA.

This PR currently does not add support for load_borrow/store_borrow and access instructions.

+1994 -26

18 comments

12 changed files

meg-gupta

pr closed time in 5 days

pull request commentapple/swift

[ownership] Enable SILMem2Reg for OSSA

I'll fix the remaining comments in a follow up PR as suggested.

meg-gupta

comment created time in 5 days

create barnchmeg-gupta/swift

branch : borrowtests

created branch time in 5 days

pull request commentapple/swift

[ownership] Enable SILMem2Reg for OSSA

@swift-ci test source compatibility

meg-gupta

comment created time in 5 days

pull request commentapple/swift

[ownership] Enable SILMem2Reg for OSSA

@swift-ci test

meg-gupta

comment created time in 6 days

pull request commentapple/swift

[ownership] Enable SILMem2Reg for OSSA

Had to force push for to fix an aggressive assert. Only difference after the approval :

--- a/lib/SILOptimizer/Transforms/SILMem2Reg.cpp
+++ b/lib/SILOptimizer/Transforms/SILMem2Reg.cpp
@@ -407,7 +407,8 @@ static void replaceLoad(LoadInst *LI, SILValue val, AllocStackInst *ASI) {
   if (LI->getOwnershipQualifier() == LoadOwnershipQualifier::Copy) {
     LI->replaceAllUsesWith(builder.createCopyValue(LI->getLoc(), val));
   } else {
-    assert(val.getOwnershipKind() != ValueOwnershipKind::Guaranteed);
+    assert(!ASI->getFunction()->hasOwnership() ||
+           val.getOwnershipKind() != ValueOwnershipKind::Guaranteed);
     LI->replaceAllUsesWith(val);
   }
meg-gupta

comment created time in 6 days

push eventmeg-gupta/swift

Meghana Gupta

commit sha 83474707eea654d81bc49565f952c84cc19508c9

Enable SILMem2Reg for OSSA SILMem2Reg has roughly 2 central algorithms, removal of alloc_stack with uses in a single block vs multiple blocks. While replacing loads and stores to the stack location in each of the 2 algorithms, new handling of qualifiers like [assign], [copy] and [take] which are new to OSSA are needed. Also Disable SILMem2Reg when we see this pattern: load [take] (struct_element_addr/tuple_element_addr %ASI) Convert SILMem2Reg tests into ossa And add new SILMem2Reg tests for non-trivial values. Thanks to zoecarver for additional tests.

view details

Meghana Gupta

commit sha 0ea5d055a20e2066ba1e034d52b1dead007a4dab

Delete debug_value_addr of stack location, if a debug_value of the RunningVal is already found

view details

Meghana Gupta

commit sha 06eaf6bba4de85631c532cb9bb9cd232758706c4

Disable SILCombine of unchecked_bitwise_cast to unchecked_ref_cast in OSSA unchecked_ref_cast is a forwarding cast while unchecked_bitwise_cast is not. We cannot just convert one to other in OSSA. Disable it now.

view details

push time in 6 days

pull request commentapple/swift

[ownership] Enable SILMem2Reg for OSSA

@swift-ci test

meg-gupta

comment created time in 6 days

push eventmeg-gupta/swift

Alexey Komnin

commit sha 4fa17bf59774ae6543a33b1a29f01320705f4dfe

SR-12022: refactor LiteralExpr to combine common initializer code

view details

Michael Gottesman

commit sha d3e6ffdbad9ed2af857508891a4530b7f11d4c6e

[lldb-toolbox] Add the ability to disassemble-to-file a specific function from a target without running the target. The routine already supports dumping the assembly to file if we are at a breakpoint using the current frame. This adds a -n option so one can without running just dump the assembly to a file of a specific function in a binary.

view details

Dave Lee

commit sha 27330f169df5d2dcb018ab2c6615d66be91d04e2

[build] Remove unused lldb cmake

view details

Keith Smiley

commit sha ae0c380f1b0f37e11b111a06634dd4c64e67b96c

Improve -*prefix-map help text Before: ``` -coverage-prefix-map <value> -debug-prefix-map <value> ``` After: ``` -coverage-prefix-map <prefix=replacement> -debug-prefix-map <prefix=replacement> ```

view details

Mike Ash

commit sha 630aff7b19b80f29445b645424e20fd1bb6bd551

[Runtime] Change SimpleGlobalCache to use ConcurrentReadableHashMap instead of ConcurrentMap. This gives us faster lookups and a small advantage in memory usage. Most of these maps need stable addresses for their entries, so we add a level of indirection to ConcurrentReadableHashMap for these cases to accommodate that. This costs some extra memory, but it's still a net win. A new StableAddressConcurrentReadableHashMap type handles this indirection and adds a convenience getOrInsert to take advantage of it. ConcurrentReadableHashMap is tweaked to avoid any global constructors or destructors when using it as a global variable. ForeignWitnessTables does not need stable addresses and it now uses ConcurrentReadableHashMap directly. rdar://problem/70056398

view details

Alexis Laferrière

commit sha e61ffea42c943044fe4fc8c35d5040bc8815e420

[Sema] Check availability in inlinable code using the explicit version Inlinable functions can be inlined in clients with a lower OS target version than the framework defining the function. For this reason, the availability in inlinable functions should always be checked using the explicit introduction OS version as lower bound and not the minimum deployment version. rdar://problem/67975153

view details

Alexis Laferrière

commit sha 53e04cb39db86d890ff674b775a5dbda47e9d599

[Sema] Test explicit versions in TypeRefinementContext

view details

Alexis Laferrière

commit sha 2f182c2b785f5f7b68ee756d1474f21f3050ba67

[Sema] Consider unavailable functions as being unreachable This has the effect of rejecting unavailable overrides to available methods in a similar way as overrides that are less available than the introduction are rejected.

view details

Alexis Laferrière

commit sha 39ee5916bd656cf56c75ddf45a47e628d0ff1db1

[SIL] Don't print availability for unreachable/unavailable functions

view details

Alexis Laferrière

commit sha c79d5cfbd6952c5dc141a24db10a87d548bc5f4f

[Sema] Still use the current minimum deployment target as fallback

view details

Alexis Laferrière

commit sha 25c9ddd7c817d4dee5a1643cc0fc32f3cf833af2

[Sema] Prioritize unavailability check for protocol witnesses The errors on explicit unavailability are more precise than those on availablity version. Make sure we prioritize the unavailability ones first.

view details

Alexis Laferrière

commit sha f536a581082633e33ea8849b7f1d2f9b0d816c6c

[Sema] Silence an inconsistent availability error for the stdlib Don't raise the error availability_decl_more_than_enclosing in the context is unavailable and if read in a swiftinterface file. This error was present in the stdlib in 5.3 without side effects so we still want to accept it.

view details

Alexis Laferrière

commit sha 429017fc7acc303d70c6251eec7c59c97255fa96

[ClangImporter] Import unavailable decls as unavailable

view details

Alexis Laferrière

commit sha d2343f23a4d14b37f1f603ae13e3421fb5455df4

[Sema] Create a new TypeRefinementContext only for explicit inlinables

view details

Alexis Laferrière

commit sha 1ca852e77a00bf8323494d7445d054ea28466b99

[Sema] Accept unavailable constructors override in unavailable types Preserve the old behavior of accepted unavailable override of constructors as this change would be source breaking.

view details

Alexis Laferrière

commit sha fca7d36cb42b044b1179254d6e38f2b8a263eeed

[Sema] Use the deployment target as minimum OS version in swiftinterfaces Preserve the previous behavior when parsing swiftinterfaces as the Swift stdlib for Swift 5.3 and a few other swiftinterfaces in Xcode 12.0 had issues that would now be reported as errors.

view details

Erik Eckstein

commit sha aced5c74df5804b7c567a1ae9cf68b7e9cb336ee

SILOptimizer: Remove InspectionMode from MemBehehaviorVisitor The InspectionMode was never set to anything else than "IgnoreRetains"

view details

Erik Eckstein

commit sha d4a6bd39b686307028b850d25a2a2fbc337160a3

SILOptimizer: improve MemBehavior for apply instructions. 1. Do a better alias analysis for "function-local" objects, like alloc_stack and inout parameters 2. Fully support try_apply and begin/end/abort_apply So far we fully relied on escape analysis. But escape analysis has some shortcomings with SIL address-types. Therefore, handle two common cases, alloc_stack and inout parameters, with alias analysis. This gives better results. The biggest change here is to do a quick check if the address escapes via an address_to_pointer instructions.

view details

Erik Eckstein

commit sha 9f85cb8576becac281397e967e67ec44e5aabc5b

TempRValueElimination: handle potential modifications of the copy-source in a called functions correctly. This fixes a miscompile in case the source of the optimized copy_addr is modified in a called function with to a not visible alias. This can happen with class properties or global variables. This fix removes the special handling of function parameters, which was just wrong. Instead it simply uses the alias analysis API to check for modifications of the source object. The fix makes TempRValueElimination more conservative and this can cause some performance regressions, but this is unavoidable. rdar://problem/69605657

view details

Erik Eckstein

commit sha 68f485424c2b655075c77877acc9ed05756c5d08

SILOptimizer: add an additional TempRValueOpt pass later in the pipeline. This can compensate the performance regression of the more conservative handling of function calls in TempRValueOpt (see previous commit). The pass runs after the inlining passes and can therefore optimize in some cases where it's not possible before inlining.

view details

push time in 10 days

Pull request review commentapple/swift

[ownership] Enable SILMem2Reg for OSSA

 static void collectLoads(SILInstruction *I, SmallVectorImpl<LoadInst *> &Loads) static void replaceLoad(LoadInst *LI, SILValue val, AllocStackInst *ASI) {   ProjectionPath projections(val->getType());   SILValue op = LI->getOperand();+  SILBuilderWithScope builder(LI);+   while (op != ASI) {     assert(isa<UncheckedAddrCastInst>(op) || isa<StructElementAddrInst>(op) ||            isa<TupleElementAddrInst>(op));     auto *Inst = cast<SingleValueInstruction>(op);     projections.push_back(Projection(Inst));     op = Inst->getOperand(0);   }-  SILBuilder builder(LI);++  SmallVector<SILValue, 4> borrowedVals;   for (auto iter = projections.rbegin(); iter != projections.rend(); ++iter) {     const Projection &projection = *iter;+    assert(projection.getKind() == ProjectionKind::BitwiseCast ||+           projection.getKind() == ProjectionKind::Struct ||+           projection.getKind() == ProjectionKind::Tuple);++    // struct_extract and tuple_extract expect guaranteed operand ownership+    // non-trivial RunningVal is owned. Insert borrow operation to convert+    if (projection.getKind() == ProjectionKind::Struct ||+        projection.getKind() == ProjectionKind::Tuple) {+      SILValue opVal = builder.emitBeginBorrowOperation(LI->getLoc(), val);+      if (opVal != val) {+        borrowedVals.push_back(opVal);+        val = opVal;+      }+    }     val = projection.createObjectProjection(builder, LI->getLoc(), val).get();   }+   op = LI->getOperand();-  LI->replaceAllUsesWith(val);+  // Replace users of the loaded value with `val`+  // If we have a load [copy], replace the users with copy_value of `val`+  if (LI->getOwnershipQualifier() == LoadOwnershipQualifier::Copy) {+    LI->replaceAllUsesWith(builder.createCopyValue(LI->getLoc(), val));+  } else {+    LI->replaceAllUsesWith(val);

@zoecarver It can happen. See mem2reg_struct_addr_load_take in mem2reg_ossa_nontrivial.sil

I disabled this pattern (load [take] (struct_element_addr/tuple_element_addr %ASI)) for now. We'll need a copy_value like gottesmm said. But we also need destroy of the original RunningVal. I started implementing it, but it started getting too complex and I don't want to add that in this PR.

@gottesmm thanks for catching this!

meg-gupta

comment created time in 12 days

PullRequestReviewEvent

push eventmeg-gupta/swift

Meghana Gupta

commit sha c4a1f1ef196204b38f47443fd74e79e38d428fd0

Enable SILMem2Reg for OSSA SILMem2Reg has roughly 2 central algorithms, removal of alloc_stack with uses in a single block vs multiple blocks. While replacing loads and stores to the stack location in each of the 2 algorithms, new handling of qualifiers like [assign], [copy] and [take] which are new to OSSA are needed. Also Disable SILMem2Reg when we see this pattern: load [take] (struct_element_addr/tuple_element_addr %ASI) Convert SILMem2Reg tests into ossa And add new SILMem2Reg tests for non-trivial values. Thanks to zoecarver for additional tests.

view details

Meghana Gupta

commit sha 4cde37ea1189a2b297a5ccf4840bed9def043e9f

Delete debug_value_addr of stack location, if a debug_value of the RunningVal is already found

view details

Meghana Gupta

commit sha 84f17c0a1b929e99525887e17b557a8987230d4e

Disable SILCombine of unchecked_bitwise_cast to unchecked_ref_cast in OSSA unchecked_ref_cast is a forwarding cast while unchecked_bitwise_cast is not. We cannot just convert one to other in OSSA. Disable it now.

view details

push time in 12 days

Pull request review commentapple/swift

[ownership] Enable SILMem2Reg for OSSA

 static void collectLoads(SILInstruction *I, SmallVectorImpl<LoadInst *> &Loads) static void replaceLoad(LoadInst *LI, SILValue val, AllocStackInst *ASI) {   ProjectionPath projections(val->getType());   SILValue op = LI->getOperand();+  SILBuilderWithScope builder(LI);+   while (op != ASI) {     assert(isa<UncheckedAddrCastInst>(op) || isa<StructElementAddrInst>(op) ||            isa<TupleElementAddrInst>(op));     auto *Inst = cast<SingleValueInstruction>(op);     projections.push_back(Projection(Inst));     op = Inst->getOperand(0);   }-  SILBuilder builder(LI);++  SmallVector<SILValue, 4> borrowedVals;   for (auto iter = projections.rbegin(); iter != projections.rend(); ++iter) {     const Projection &projection = *iter;+    assert(projection.getKind() == ProjectionKind::BitwiseCast ||+           projection.getKind() == ProjectionKind::Struct ||+           projection.getKind() == ProjectionKind::Tuple);++    // struct_extract and tuple_extract expect guaranteed operand ownership+    // non-trivial RunningVal is owned. Insert borrow operation to convert+    if (projection.getKind() == ProjectionKind::Struct ||+        projection.getKind() == ProjectionKind::Tuple) {+      SILValue opVal = builder.emitBeginBorrowOperation(LI->getLoc(), val);+      if (opVal != val) {+        borrowedVals.push_back(opVal);+        val = opVal;+      }+    }     val = projection.createObjectProjection(builder, LI->getLoc(), val).get();   }+   op = LI->getOperand();-  LI->replaceAllUsesWith(val);+  // Replace users of the loaded value with `val`+  // If we have a load [copy], replace the users with copy_value of `val`+  if (LI->getOwnershipQualifier() == LoadOwnershipQualifier::Copy) {+    LI->replaceAllUsesWith(builder.createCopyValue(LI->getLoc(), val));+  } else {+    LI->replaceAllUsesWith(val);

Actually gottesmm is right. Loaded val is owned, but the result of struct_extract will be guaranteed

meg-gupta

comment created time in 12 days

PullRequestReviewEvent

Pull request review commentapple/swift

[ownership] Enable SILMem2Reg for OSSA

 static void collectLoads(SILInstruction *I, SmallVectorImpl<LoadInst *> &Loads) static void replaceLoad(LoadInst *LI, SILValue val, AllocStackInst *ASI) {   ProjectionPath projections(val->getType());   SILValue op = LI->getOperand();+  SILBuilderWithScope builder(LI);+   while (op != ASI) {     assert(isa<UncheckedAddrCastInst>(op) || isa<StructElementAddrInst>(op) ||            isa<TupleElementAddrInst>(op));     auto *Inst = cast<SingleValueInstruction>(op);     projections.push_back(Projection(Inst));     op = Inst->getOperand(0);   }-  SILBuilder builder(LI);++  SmallVector<SILValue, 4> borrowedVals;   for (auto iter = projections.rbegin(); iter != projections.rend(); ++iter) {     const Projection &projection = *iter;+    assert(projection.getKind() == ProjectionKind::BitwiseCast ||+           projection.getKind() == ProjectionKind::Struct ||+           projection.getKind() == ProjectionKind::Tuple);++    // struct_extract and tuple_extract expect guaranteed operand ownership+    // non-trivial RunningVal is owned. Insert borrow operation to convert+    if (projection.getKind() == ProjectionKind::Struct ||+        projection.getKind() == ProjectionKind::Tuple) {+      SILValue opVal = builder.emitBeginBorrowOperation(LI->getLoc(), val);+      if (opVal != val) {+        borrowedVals.push_back(opVal);+        val = opVal;+      }+    }     val = projection.createObjectProjection(builder, LI->getLoc(), val).get();   }+   op = LI->getOperand();-  LI->replaceAllUsesWith(val);+  // Replace users of the loaded value with `val`+  // If we have a load [copy], replace the users with copy_value of `val`+  if (LI->getOwnershipQualifier() == LoadOwnershipQualifier::Copy) {+    LI->replaceAllUsesWith(builder.createCopyValue(LI->getLoc(), val));+  } else {+    LI->replaceAllUsesWith(val);

Right. val is owned here. borrow scope will end before the uses of loaded value.

meg-gupta

comment created time in 12 days

PullRequestReviewEvent

Pull request review commentapple/swift

[ownership] Enable SILMem2Reg for OSSA

 StackAllocationPromoter::promoteAllocationInBlock(SILBasicBlock *BB) {         // If we are loading from the AllocStackInst and we already know the         // content of the Alloca then use it.         LLVM_DEBUG(llvm::dbgs() << "*** Promoting load: " << *Load);-                 replaceLoad(Load, RunningVal, ASI);         ++NumInstRemoved;

There is a continue in the outer if. I'll add it here for clarity.

meg-gupta

comment created time in 12 days

PullRequestReviewEvent

Pull request review commentapple/swift

[ownership] Enable SILMem2Reg for OSSA

 static void collectLoads(SILInstruction *I, SmallVectorImpl<LoadInst *> &Loads) static void replaceLoad(LoadInst *LI, SILValue val, AllocStackInst *ASI) {   ProjectionPath projections(val->getType());   SILValue op = LI->getOperand();+  SILBuilderWithScope builder(LI);+   while (op != ASI) {     assert(isa<UncheckedAddrCastInst>(op) || isa<StructElementAddrInst>(op) ||            isa<TupleElementAddrInst>(op));     auto *Inst = cast<SingleValueInstruction>(op);     projections.push_back(Projection(Inst));     op = Inst->getOperand(0);   }-  SILBuilder builder(LI);++  SmallVector<SILValue, 4> borrowedVals;   for (auto iter = projections.rbegin(); iter != projections.rend(); ++iter) {     const Projection &projection = *iter;+    assert(projection.getKind() == ProjectionKind::BitwiseCast ||+           projection.getKind() == ProjectionKind::Struct ||+           projection.getKind() == ProjectionKind::Tuple);++    // struct_extract and tuple_extract expect guaranteed operand ownership+    // non-trivial RunningVal is owned. Insert borrow operation to convert+    if (projection.getKind() == ProjectionKind::Struct ||+        projection.getKind() == ProjectionKind::Tuple) {+      SILValue opVal = builder.emitBeginBorrowOperation(LI->getLoc(), val);+      if (opVal != val) {+        borrowedVals.push_back(opVal);+        val = opVal;+      }+    }     val = projection.createObjectProjection(builder, LI->getLoc(), val).get();   }+   op = LI->getOperand();-  LI->replaceAllUsesWith(val);+  // Replace users of the loaded value with `val`+  // If we have a load [copy], replace the users with copy_value of `val`+  if (LI->getOwnershipQualifier() == LoadOwnershipQualifier::Copy) {+    LI->replaceAllUsesWith(builder.createCopyValue(LI->getLoc(), val));+  } else {+    LI->replaceAllUsesWith(val);

Looking..

meg-gupta

comment created time in 12 days

PullRequestReviewEvent

Pull request review commentapple/swift

[ownership] Enable SILMem2Reg for OSSA

 visitUncheckedTrivialBitCastInst(UncheckedTrivialBitCastInst *UTBCI) { SILInstruction * SILCombiner:: visitUncheckedBitwiseCastInst(UncheckedBitwiseCastInst *UBCI) {+  if (UBCI->getFunction()->hasOwnership())

@gottesmm It doesn't have a real impact today. So should be fine ? But will become important when we are moving OSSA beyond SILCombine.

meg-gupta

comment created time in 12 days

PullRequestReviewEvent

Pull request review commentapple/swift

[ownership] Enable SILMem2Reg for OSSA

 static void collectLoads(SILInstruction *I, SmallVectorImpl<LoadInst *> &Loads) static void replaceLoad(LoadInst *LI, SILValue val, AllocStackInst *ASI) {   ProjectionPath projections(val->getType());   SILValue op = LI->getOperand();+  SILBuilder builder(LI);

Done

meg-gupta

comment created time in 12 days

PullRequestReviewEvent

push eventmeg-gupta/swift

Meghana Gupta

commit sha 28d96c68fa7f4a2eb8211987a116129b337eb6dd

Delete debug_value_addr of stack location, if a debug_value of the RunningVal is already found

view details

Meghana Gupta

commit sha 5800a0a003dcdd985359fe46fdbb619d9e903494

Disable SILCombine of unchecked_bitwise_cast to unchecked_ref_cast in OSSA unchecked_ref_cast is a forwarding cast while unchecked_bitwise_cast is not. We cannot just convert one to other in OSSA. Disable it now.

view details

push time in 12 days

push eventmeg-gupta/swift

Meghana Gupta

commit sha d9302ca917da5aa819dbac1e89294515304ae98d

Enable SILMem2Reg for OSSA SILMem2Reg has roughly 2 central algorithms, removal of alloc_stack with uses in a single block vs multiple blocks. While replacing loads and stores to the stack location in each of the 2 algorithms, new handling of qualifiers like [assign], [copy] and [take] which are new to OSSA are needed. Convert SILMem2Reg tests into ossa And add new SILMem2Reg tests for non-trivial values. Thanks to zoecarver for additional tests.

view details

Meghana Gupta

commit sha a1d3f78c081dd0ba20c26e84d90bba3f5942ed31

Delete debug_value_addr of stack location, if a debug_value of the RunningVal is already found

view details

Meghana Gupta

commit sha 5bd11af71d6f80c7887e18f2b11e6a52c8629f75

Disable SILCombine of unchecked_bitwise_cast to unchecked_ref_cast in OSSA unchecked_ref_cast is a forwarding cast while unchecked_bitwise_cast is not. We cannot just convert one to other in OSSA. Disable it now.

view details

push time in 12 days

Pull request review commentapple/swift

[ownership] Enable SILMem2Reg for OSSA

 import Builtin import Swift +class Klass {}+

TODO: Remove this line from the test

meg-gupta

comment created time in 13 days

PullRequestReviewEvent

pull request commentapple/swift

[ownership] Enable SILMem2Reg for OSSA

@gottesmm cleaned up history and added dead phi arg removal in the pass.

meg-gupta

comment created time in 13 days

push eventmeg-gupta/swift

Meghana Gupta

commit sha 1ba752db9e7fbbbac65272244ef9c830afc6b7ef

Enable SILMem2Reg for OSSA SILMem2Reg has roughly 2 central algorithms, removal of alloc_stack with uses in a single block vs multiple blocks. While replacing loads and stores to the stack location in each of the 2 algorithms, new handling of qualifiers like [assign], [copy] and [take] which are new to OSSA are needed. Convert SILMem2Reg tests into ossa And add new SILMem2Reg tests for non-trivial values. Thanks to additional tests by zoecarver.

view details

Meghana Gupta

commit sha 2a538cf3971a0e68ac6870c1b47e06d128b6ea62

Delete debug_value_addr of stack location, if a debug_value of the RunningVal is already found

view details

Meghana Gupta

commit sha 8e42060dd8c26a5ffede48057da6c003d27c6db1

Disable SILCombine of unchecked_bitwise_cast to unchecked_ref_cast in OSSA unchecked_ref_cast is a forwarding cast while unchecked_bitwise_cast is not. We cannot just convert one to other in OSSA. Disable it now.

view details

push time in 13 days

push eventmeg-gupta/swift

Meghana Gupta

commit sha eff6b66906f094026afe1a61dae44d4eeba2709b

Add hasOwnership assertion in SILBuilder while creating unchecked_value_cast

view details

Meghana Gupta

commit sha aa897a8c5d029b9283d26379ea25069c2621f247

Enable SILMem2Reg for OSSA SILMem2Reg has roughly 2 central algorithms, removal of alloc_stack with uses in a single block vs multiple blocks. While replacing loads and stores to the stack location in each of the 2 algorithms, new handling of qualifiers like [assign], [copy] and [take] which are new to OSSA are needed. Convert SILMem2Reg tests into ossa And add new SILMem2Reg tests for non-trivial values. Thanks to additional tests by zoecarver.

view details

Meghana Gupta

commit sha 7153731b8646d768d0afe713521dcf88c5f32a90

Delete debug_value_addr of stack location, if a debug_value of the RunningVal is already found

view details

Meghana Gupta

commit sha 7dcf44b2e21595b8d8778f922c52999f344bc18a

Disable SILCombine of unchecked_bitwise_cast to unchecked_ref_cast in OSSA unchecked_ref_cast is a forwarding cast while unchecked_bitwise_cast is not. We cannot just convert one to other in OSSA. Disable it now.

view details

push time in 13 days

push eventmeg-gupta/swift

Meghana Gupta

commit sha dfd509e8ec2370e4e046736dd0206c7d77b26c87

Enable SILMem2Reg for OSSA SILMem2Reg has roughly 2 central algorithms, removal of alloc_stack with uses in a single block vs multiple blocks. While replacing loads and stores to the stack location in each of the 2 algorithms, new handling of qualifiers like [assign], [copy] and [take] which are new to OSSA are needed. Convert SILMem2Reg tests into ossa And add new SILMem2Reg tests for non-trivial values. Thanks to additional tests by zoecarver.

view details

Meghana Gupta

commit sha 9c53c3fb4abac2c43ca400de61bdbbb0356e3d65

Delete debug_value_addr of stack location, if a debug_value of the RunningVal is already found

view details

Meghana Gupta

commit sha 454040f0494f7e1849eca3038b77aad6e3b398b0

Disable unchecked_addr_cast to unchecked_ref_cast in OSSA unchecked_ref_cast is a forwarding cast while unchecked_addr_cast is not. We cannot just convert one to other in OSSA. Disable it now.

view details

push time in 13 days

pull request commentapple/swift

[ownership] Enable SILMem2Reg for OSSA

Add a case for DestroyAddrInst to isWriteOnlyAllocation.

Looked into this. This is not okay because we just erase instructions in the case of isWriteOnlyAllocation. But a destroy_addr will need to be transformed to the destroy_val of the RunningVal

meg-gupta

comment created time in 14 days

Pull request review commentapple/swift

[ownership] Enable SILMem2Reg for OSSA

 void MemoryToRegisters::removeSingleBlockAllocation(AllocStackInst *ASI) {     // value.     if (auto *SI = dyn_cast<StoreInst>(Inst)) {       if (SI->getDest() == ASI) {+        if (SI->getOwnershipQualifier() == StoreOwnershipQualifier::Assign) {

https://github.com/apple/swift/blob/0b456ba795f6e9aa25e1910a8bcad901567943c6/lib/SILOptimizer/Transforms/SILMem2Reg.cpp#L376 The pass already does transform the destroy_addr to the destroy_value of the RunningVal. Same for [assign]

meg-gupta

comment created time in 14 days

PullRequestReviewEvent

pull request commentapple/swift

[ownership] Enable SILMem2Reg for OSSA

@zoecarver I am going to test #30812 with this branch and see how it goes.

Sounds good! You should make sure you can also build the stdlib with both patches applied.

No new bugs with access instructions. I think its best to handle it separately from this PR. #30812 will need some OSSA tests.

meg-gupta

comment created time in 14 days

push eventmeg-gupta/swift

Meghana Gupta

commit sha b30bfafaad535fca4a964b50d6e6b6d4dc5fb30f

Enable SILMem2Reg for OSSA SILMem2Reg has roughly 2 central algorithms, removal of alloc_stack with uses in a single block vs multiple blocks. While replacing loads and stores to the stack location in each of the 2 algorithms, new handling of qualifiers like [assign], [copy] and [take] which are new to OSSA are needed. Add new SILMem2Reg tests for non-trivial values

view details

Meghana Gupta

commit sha 7e484c52c09f6250e6cae6eb5fc9f0f1228d8398

Delete debug_value_addr of stack location, if a debug_value of the RunningVal is already found

view details

Meghana Gupta

commit sha fbd6fd0ce22edf8efdc83fa3b6a4ded09bed2307

Disable unchecked_addr_cast to unchecked_ref_cast in OSSA unchecked_ref_cast is a forwarding cast while unchecked_addr_cast is not. We cannot just convert one to other in OSSA. Disable it now.

view details

Meghana Gupta

commit sha f8d863df3a436bbda3759c9e5199a8cf5c4d5e8e

Add SILMem2Reg tests by zoecarver

view details

push time in 14 days

PullRequestReviewEvent

Pull request review commentapple/swift

[ownership] Enable SILMem2Reg for OSSA

 void MemoryToRegisters::removeSingleBlockAllocation(AllocStackInst *ASI) {     // value.     if (auto *SI = dyn_cast<StoreInst>(Inst)) {       if (SI->getDest() == ASI) {+        if (SI->getOwnershipQualifier() == StoreOwnershipQualifier::Assign) {

Since [init] in a way 'forwards' the ownership to the stack location, we don't need to destroy the src. We'll have a later destroy_addr of the stack location which gets transformed separately.

meg-gupta

comment created time in 14 days

PullRequestReviewEvent

pull request commentapple/swift

[ownership] Enable SILMem2Reg for OSSA

@zoecarver I am going to test https://github.com/apple/swift/pull/30812 with this branch and see how it goes.

meg-gupta

comment created time in 14 days

PullRequestReviewEvent

Pull request review commentapple/swift

[ownership] Enable SILMem2Reg for OSSA

 void MemoryToRegisters::removeSingleBlockAllocation(AllocStackInst *ASI) {     // value.     if (auto *SI = dyn_cast<StoreInst>(Inst)) {       if (SI->getDest() == ASI) {+        if (SI->getOwnershipQualifier() == StoreOwnershipQualifier::Assign) {

Am destroying the previous value stored in the stack location here. Since definition of [init] allows us to assume it is the first store to the stack location there is no need for destroy here.

meg-gupta

comment created time in 14 days

Pull request review commentapple/swift

[ownership] Enable SILMem2Reg for OSSA

 class SILBuilder {    UncheckedValueCastInst *createUncheckedValueCast(SILLocation Loc, SILValue Op,                                                    SILType Ty) {+    assert(hasOwnership());

I think so - https://github.com/apple/swift/blob/main/docs/SIL.rst#unchecked_value_cast @gottesmm to confirm

meg-gupta

comment created time in 14 days

Pull request review commentapple/swift

[ownership] Enable SILMem2Reg for OSSA

 StackAllocationPromoter::promoteAllocationInBlock(SILBasicBlock *BB) {       if (SI->getDest() != ASI)         continue; -      // The stored value is the new running value.-      RunningVal = SI->getSrc();+      // Special handling of entry block+      // If we have a store [assign] in the first block, OSSA guarantees we can+      // find the previous value stored in the stack location in RunningVal.+      // Create destroy_value of the RunningVal.+      // For all other blocks we may not know the previous value stored in the+      // stack location. So we will create destroy_value in+      // StackAllocationPromoter::fixBranchesAndUses, by getting the live-in+      // value to the block.+      if (BB->isEntry()) {+        if (SI->getOwnershipQualifier() == StoreOwnershipQualifier::Assign) {+          assert(RunningVal);+          SILBuilder builder(SI);

Yes! Will fix.

meg-gupta

comment created time in 14 days

Pull request review commentapple/swift

[ownership] Enable SILMem2Reg for OSSA

 StackAllocationPromoter::promoteAllocationInBlock(SILBasicBlock *BB) {       if (SI->getDest() != ASI)         continue; -      // The stored value is the new running value.-      RunningVal = SI->getSrc();+      // Special handling of entry block+      // If we have a store [assign] in the first block, OSSA guarantees we can+      // find the previous value stored in the stack location in RunningVal.+      // Create destroy_value of the RunningVal.+      // For all other blocks we may not know the previous value stored in the+      // stack location. So we will create destroy_value in+      // StackAllocationPromoter::fixBranchesAndUses, by getting the live-in+      // value to the block.+      if (BB->isEntry()) {

Yes this function does handle multiple block uses. I don't think ValueLifetimeAnalysis is needed to figure out destroys here, because store [assign] is the point where the previous value stored in the stack location is destroyed.

meg-gupta

comment created time in 14 days

Pull request review commentapple/swift

[ownership] Enable SILMem2Reg for OSSA

 StackAllocationPromoter::promoteAllocationInBlock(SILBasicBlock *BB) {         // If we are loading from the AllocStackInst and we already know the         // content of the Alloca then use it.         LLVM_DEBUG(llvm::dbgs() << "*** Promoting load: " << *Load);-                 replaceLoad(Load, RunningVal, ASI);         ++NumInstRemoved;-      } else if (Load->getOperand() == ASI) {+      } else if (Load->getOperand() == ASI &&+                 Load->getOwnershipQualifier() !=+                     LoadOwnershipQualifier::Copy) {         // If we don't know the content of the AllocStack then the loaded         // value *is* the new value;+        // Don't use result of load [copy] as a RunningVal, it necessitates+        // additional logic for cleanup of consuming instructions of the result.

I'll update the comment, needs more clarification. This doesn't in any way weaken the optimization. It just adds more work for StackAllocationPromoter::fixBranchesAndUses because we prune less in StackAllocationPromoter::promoteAllocationInBlock now.

meg-gupta

comment created time in 14 days

Pull request review commentapple/swift

[ownership] Enable SILMem2Reg for OSSA

 static void collectLoads(SILInstruction *I, SmallVectorImpl<LoadInst *> &Loads) static void replaceLoad(LoadInst *LI, SILValue val, AllocStackInst *ASI) {   ProjectionPath projections(val->getType());   SILValue op = LI->getOperand();+  SILBuilder builder(LI);+   while (op != ASI) {

Yes! Thanks for pointing out.

meg-gupta

comment created time in 14 days

Pull request review commentapple/swift

[ownership] Enable SILMem2Reg for OSSA

 static void collectLoads(SILInstruction *I, SmallVectorImpl<LoadInst *> &Loads) static void replaceLoad(LoadInst *LI, SILValue val, AllocStackInst *ASI) {   ProjectionPath projections(val->getType());   SILValue op = LI->getOperand();+  SILBuilder builder(LI);+   while (op != ASI) {     assert(isa<UncheckedAddrCastInst>(op) || isa<StructElementAddrInst>(op) ||            isa<TupleElementAddrInst>(op));     auto *Inst = cast<SingleValueInstruction>(op);     projections.push_back(Projection(Inst));     op = Inst->getOperand(0);   }-  SILBuilder builder(LI);++  SmallVector<SILValue, 4> borrowedVals;   for (auto iter = projections.rbegin(); iter != projections.rend(); ++iter) {     const Projection &projection = *iter;-    val = projection.createObjectProjection(builder, LI->getLoc(), val).get();+    SILValue opVal = val;+    // TODO: Is there a better way to check for the need of begin_borrow ?+    if (projection.getKind() == ProjectionKind::Struct ||+        projection.getKind() == ProjectionKind::Tuple) {+      opVal = builder.emitBeginBorrowOperation(LI->getLoc(), val);+      if (opVal != val) {+        borrowedVals.push_back(opVal);+      }+    }+    else {

Yes! Will fix.

meg-gupta

comment created time in 14 days

PullRequestReviewEvent
PullRequestReviewEvent

pull request commentapple/swift

[ownership] Enable SILMem2Reg for OSSA

@swift-ci test

meg-gupta

comment created time in 14 days

push eventmeg-gupta/swift

Meghana Gupta

commit sha e929c1e24ed01239d1077395dac5238c8aeeb6fc

Delete debug_value_addr of stack location, if a debug_value of the RunningVal is already found

view details

Meghana Gupta

commit sha 51d145021475736424f263e979ce9eb5cc2226da

Disable unchecked_addr_cast to unchecked_ref_cast in OSSA unchecked_ref_cast is a forwarding cast while unchecked_addr_cast is not. We cannot just convert one to other in OSSA. Disable it now.

view details

push time in 14 days

pull request commentapple/swift

[ownership] Enable SILMem2Reg for OSSA

@swift-ci test

meg-gupta

comment created time in 14 days

PR opened apple/swift

[ownership] Enable SILMem2Reg for OSSA
+1759 -18

0 comment

11 changed files

pr created time in 14 days

push eventmeg-gupta/swift

Meghana Gupta

commit sha 7cea31ba3c055ca316b344b3ca8eff8f35a5baa1

SILMem2Reg: Don't add dead values as phi arguments A dealloc_stack ends the lifetime of an alloc_stack on a path. We don't have to pass RunningVal beyond the dealloc_stack as phi argument to the post dominating block.

view details

Meghana Gupta

commit sha a87c18d53a1f67eb9e9cd729dbb24359e1a18dfd

Allow empty consuming uses for a phi arg under special conditions If a phi arg has only undef incoming values and is being used as a phi arg only, disable raising an error that the phi arg does not have consuming uses. SILMem2Reg can create such a SIL, and instead of re-implementing dead code of phi args in the pass, allow the ownership verifier to ignore this edge case since this does not lead to a leak in practice.

view details

Meghana Gupta

commit sha 37240b2cb705f3b89b8e18dbf382c7af1a221a88

Add an assertion in SILBuilder while creating unchecked_value_cast

view details

Meghana Gupta

commit sha 0e176f9ee2da4045af0107869d261162ef027207

Convert SILMem2Reg tests into ossa

view details

Meghana Gupta

commit sha 6b3258ab08db7b4fb79ef24595d7a5e123c6a56f

Enable SILMem2Reg for OSSA SILMem2Reg has roughly 2 central algorithms, removal of alloc_stack with uses in a single block vs multiple blocks. While replacing loads and stores to the stack location in each of the 2 algorithms, new handling of qualifiers like [assign], [copy] and [take] which are new to OSSA are needed. Add new SILMem2Reg tests for non-trivial values

view details

push time in 14 days

push eventmeg-gupta/swift

Antoine Cœur

commit sha 4c30f8bd6de5487603ed645cc4dd2a2983f4f0ba

appendingPathComponent(:isDirectory:) should account for isDirectory

view details

Xiaodi Wu

commit sha 26cda274ca78b1df246521ba1eeea33285b57d5f

[stdlib] Simplify 'BinaryFloatingPoint.init?<T: BinaryFloatingPoint>(exactly: T)'

view details

Mike Ash

commit sha ece0399d601eec1069131f465bdbe7e16f4c6a50

[Runtime] Have ConcurrentReadableHashMap use 1-byte or 2-byte indices when possible.

view details

Alexis Laferrière

commit sha 14e6772dc04cf778ba393bebc21a0a8b8ada3603

Consider inherited platform unavailability to silence diagnostics rdar://68597591

view details

Arnold Schwaighofer

commit sha 8e8c57caf59f043b4046ad0df6e7c358bcac9903

SIL type lowering: Compute IsTypeExpansionSensitive and use it instead of TypeBase's hasOpaqueArchetypePropertiesOrCases A type is IsTypeExpansionSensitive if it contains an opaque result type that influences how the type is lowered. This could be because the type mentions an opaque archetype and therefore we would look through to the underlying type depending on the type expansion and could get a different SIL type. For example '() -> out some P' could lower to '() -> @out Int'. Or this could be because when we lower an aggregate type some of its fields are opaque types that could be looked through and therefore the aggregate has different lowering (e.g address vs. loadable) in different type expansion contexts. By replacing it this change also fixes an infinite recursion in hasOpaqueArchetypePropertiesOrCases. rdar://68798822

view details

Cassie Jones

commit sha e01893cb56f989b20ba4309286450105211f031e

[build-script] Add a flag for sccache This adds a flag to enable sccache in order to simplify the build-script invocation, particularly for new contributors.

view details

Cassie Jones

commit sha 6d92486c9a6ddc8b71f7c842d546ae3599be5c30

[build-script] Add SWIFT_ prefix to USE_SCCACHE env var

view details

Nate Chandler

commit sha 4cfadfae00f31fc66581ad270176e4916682bf51

[NFC] Documented IRGenFunction::IndirectReturn.

view details

Nate Chandler

commit sha 607772aaa21ce58db04236cb817b5958c72b2123

[Runtime] Stubbed entry points for task de/alloc.

view details

Cassie Jones

commit sha 7ef9b3287ab097ce2bdd1ab70f9ed9df20d39ff1

[build-script] Fix CMake sccache test

view details

Josh Learn

commit sha 1fd6ef95ce483dd7447e09935597cde5c42c14fc

[OSLog] Update compiler stubs and tests The compiler stubs for testing the OSLog implementation are in need of an update. This change updates the stubs to be consistent with the current OSLog implementation, updates the existing tests, and adds new tests for String and metatype interpolations. rdar://69719729

view details

Robert Widmann

commit sha 74765a8ba82a14d3fce03e156049f65845c2cbfa

Remove Type Body Fingerprints Flags This infrastructure has more than proven itself. Drop the code paths and tests supporting the status quo.

view details

Joe Groff

commit sha a664a33b52680bca4c80d6749583a86da6bac902

SIL: Add instructions to represent async suspend points. `get_async_continuation[_addr]` begins a suspend operation by accessing the continuation value that can resume the task, which can then be used in a callback or event handler before executing `await_async_continuation` to suspend the task.

view details

Robert Widmann

commit sha 964f640636d848318d35fc48e25df624a55fef91

Drop "Private Deps" Flag In order for type body fingerprints to work, these declarations must always be included. Drop the ability to turn this off.

view details

Fero

commit sha 28f3e442135d7ae60c1522e8da41322350f84171

Fix typo

view details

Fero

commit sha b0b546873ca8c47b99cdae99110f94d2cbaa5283

Fix typo

view details

Erik Eckstein

commit sha 903786f5ab88056e2abc5b5db99b0107d6d06461

tests: correct availability checks in Interpreter/runtime_name_local_class_opaque_type.swift The test checks a fix, which also affects the runtime. Therefore, the test requires a minimum OS version to run without a crash.

view details

Cassie Jones

commit sha b5247d2c8f9c4133ba165370d92370600cf67ece

Fix formatting issue

view details

Cassie Jones

commit sha d74cad69600eb498f3f875a8418769b98fa0365e

[Localization] Install only *.db and *.yaml files (#34139) This prevents us from picking up the .gitkeep file and any other stray files that might end up in there.

view details

Egor Zhdan

commit sha ae9715ac0311e1d65dc4fed957e067ee2654d8ea

WinSDK: extract System submodule with winioctl.h Currently this header gets included into `WinSDK.WinSock2` via windows.h & winscard.h

view details

push time in 14 days

push eventmeg-gupta/swift

Antoine Cœur

commit sha 4c30f8bd6de5487603ed645cc4dd2a2983f4f0ba

appendingPathComponent(:isDirectory:) should account for isDirectory

view details

Xiaodi Wu

commit sha 26cda274ca78b1df246521ba1eeea33285b57d5f

[stdlib] Simplify 'BinaryFloatingPoint.init?<T: BinaryFloatingPoint>(exactly: T)'

view details

Mike Ash

commit sha ece0399d601eec1069131f465bdbe7e16f4c6a50

[Runtime] Have ConcurrentReadableHashMap use 1-byte or 2-byte indices when possible.

view details

Alexis Laferrière

commit sha 14e6772dc04cf778ba393bebc21a0a8b8ada3603

Consider inherited platform unavailability to silence diagnostics rdar://68597591

view details

Arnold Schwaighofer

commit sha 8e8c57caf59f043b4046ad0df6e7c358bcac9903

SIL type lowering: Compute IsTypeExpansionSensitive and use it instead of TypeBase's hasOpaqueArchetypePropertiesOrCases A type is IsTypeExpansionSensitive if it contains an opaque result type that influences how the type is lowered. This could be because the type mentions an opaque archetype and therefore we would look through to the underlying type depending on the type expansion and could get a different SIL type. For example '() -> out some P' could lower to '() -> @out Int'. Or this could be because when we lower an aggregate type some of its fields are opaque types that could be looked through and therefore the aggregate has different lowering (e.g address vs. loadable) in different type expansion contexts. By replacing it this change also fixes an infinite recursion in hasOpaqueArchetypePropertiesOrCases. rdar://68798822

view details

Cassie Jones

commit sha e01893cb56f989b20ba4309286450105211f031e

[build-script] Add a flag for sccache This adds a flag to enable sccache in order to simplify the build-script invocation, particularly for new contributors.

view details

Cassie Jones

commit sha 6d92486c9a6ddc8b71f7c842d546ae3599be5c30

[build-script] Add SWIFT_ prefix to USE_SCCACHE env var

view details

Nate Chandler

commit sha 4cfadfae00f31fc66581ad270176e4916682bf51

[NFC] Documented IRGenFunction::IndirectReturn.

view details

Nate Chandler

commit sha 607772aaa21ce58db04236cb817b5958c72b2123

[Runtime] Stubbed entry points for task de/alloc.

view details

Cassie Jones

commit sha 7ef9b3287ab097ce2bdd1ab70f9ed9df20d39ff1

[build-script] Fix CMake sccache test

view details

Josh Learn

commit sha 1fd6ef95ce483dd7447e09935597cde5c42c14fc

[OSLog] Update compiler stubs and tests The compiler stubs for testing the OSLog implementation are in need of an update. This change updates the stubs to be consistent with the current OSLog implementation, updates the existing tests, and adds new tests for String and metatype interpolations. rdar://69719729

view details

Robert Widmann

commit sha 74765a8ba82a14d3fce03e156049f65845c2cbfa

Remove Type Body Fingerprints Flags This infrastructure has more than proven itself. Drop the code paths and tests supporting the status quo.

view details

Joe Groff

commit sha a664a33b52680bca4c80d6749583a86da6bac902

SIL: Add instructions to represent async suspend points. `get_async_continuation[_addr]` begins a suspend operation by accessing the continuation value that can resume the task, which can then be used in a callback or event handler before executing `await_async_continuation` to suspend the task.

view details

Robert Widmann

commit sha 964f640636d848318d35fc48e25df624a55fef91

Drop "Private Deps" Flag In order for type body fingerprints to work, these declarations must always be included. Drop the ability to turn this off.

view details

Fero

commit sha 28f3e442135d7ae60c1522e8da41322350f84171

Fix typo

view details

Fero

commit sha b0b546873ca8c47b99cdae99110f94d2cbaa5283

Fix typo

view details

Erik Eckstein

commit sha 903786f5ab88056e2abc5b5db99b0107d6d06461

tests: correct availability checks in Interpreter/runtime_name_local_class_opaque_type.swift The test checks a fix, which also affects the runtime. Therefore, the test requires a minimum OS version to run without a crash.

view details

Cassie Jones

commit sha b5247d2c8f9c4133ba165370d92370600cf67ece

Fix formatting issue

view details

Cassie Jones

commit sha d74cad69600eb498f3f875a8418769b98fa0365e

[Localization] Install only *.db and *.yaml files (#34139) This prevents us from picking up the .gitkeep file and any other stray files that might end up in there.

view details

Egor Zhdan

commit sha ae9715ac0311e1d65dc4fed957e067ee2654d8ea

WinSDK: extract System submodule with winioctl.h Currently this header gets included into `WinSDK.WinSock2` via windows.h & winscard.h

view details

push time in 14 days

push eventmeg-gupta/swift

Meghana Gupta

commit sha d3779756851609890ed70c868839a984a55b76f7

Allow empty consuming uses for a phi arg under special conditions If a phi arg has only undef incoming values and is begin used as other phi args only, disable raising an error that the phi arg does not have consuming uses. SILMem2Reg can create such a SIL, and instead of re-implementing dead code of phi args in Mem2Reg, allow the ownership verifier to ignore this edge case since this does not lead to a leak in practice.

view details

Meghana Gupta

commit sha 20be96f182bbe43e0b46604e3eedb705c99a7f00

Add an assertion in SILBuilder while creating unchecked_value_cast

view details

Meghana Gupta

commit sha 4d7c04e2ac79dc155411ee316ef99b17a8d9b33e

Convert SILMem2Reg tests into ossa

view details

Meghana Gupta

commit sha d687bb0e3a18b95c8710deff1f30510fd6bdd02e

Enable SILMem2Reg for OSSA SILMem2Reg has roughly 2 central algorithms, removal of alloc_stack with uses in a single block vs multiple blocks. While replacing loads and stores to the stack location in each of the 2 algorithms, new handling of qualifiers like [assign], [copy] and [take] which are new to OSSA are needed. Add new SILMem2Reg tests for non-trivial values

view details

push time in 15 days

push eventmeg-gupta/swift

Meghana Gupta

commit sha 3979c61dd7b4a6e32a13ecf9a9674cfa56a8438d

Convert SILMem2Reg tests into ossa

view details

Meghana Gupta

commit sha 1ea549fb30d8dcb590fefa3a4b1c42e5d4e7ee77

Enable SILMem2Reg for OSSA SILMem2Reg has roughly 2 central algorithms, removal of alloc_stack with uses in a single block vs multiple blocks. While replacing loads and stores to the stack location in each of the 2 algorithms, new handling of qualifiers like [assign], [copy] and [take] which are new to OSSA are needed. Add new SILMem2Reg tests for non-trivial values

view details

Meghana Gupta

commit sha 5decf5d3677d770968f4d9d765728e4b67855e3e

Allow empty consuming uses for a phi arg under special conditions If a phi arg has only undef incoming values and is begin used as other phi args only, disable raising an error that the phi arg does not have consuming uses. SILMem2Reg can create such a SIL, and instead of re-implementing dead code of phi args in Mem2Reg, allow the ownership verifier to ignore this edge case since this does not lead to a leak in practice.

view details

Meghana Gupta

commit sha 149e97c2f86af39cf7a21114cf2b9560408595ed

Add an assertion in SILBuilder while creating unchecked_value_cast

view details

Meghana Gupta

commit sha e39a283a1bca196f4e6b47b050a56dcf44c1dc2b

Move OME past Mem2Reg

view details

push time in 17 days

push eventmeg-gupta/swift

Yuta Saito

commit sha d6cddaabb59958737e048ff1a5dd4d283c555661

[LTO] Support LLVM LTO for driver This commit adds LTO support for handling linker options and LLVM BC emission. Even for ELF, swift-autolink-extract is unnecessary because linker options are embeded in LLVM BC content when LTO.

view details

Owen Voorhees

commit sha 6b6b640e133ca547139c6586eb0dcbf7933b46ec

[Driver] Don't test for null source locations in driver diagnostics swift-driver doesn't emit these, and there's no reason to check that they're present when using the integrated driver.

view details

Varun Gandhi

commit sha e48469d03c87f8c1b87a2462fa3cd8c27c4d685f

[NFC] Add missing invariant checks for ExtInfoBuilders.

view details

Varun Gandhi

commit sha 384edd1f2b9c64d96dec169460b232f4ce14223f

[docs] Link 'The Swift Runtime' blog posts in ExternalResources.md.

view details

Erik Eckstein

commit sha 063929b3f022190bb578e3888215788e2e090bcf

Demangler: fix a crash when re-mangling retroactive conformances If there are multiple retroactive conformances in the mangling tree, they are put under a TypeList node. This case was not handled by the re-mangler. The crash shows up in an assert-build of the compiler, because the re-mangler is used for mangling verification. rdar://problem/68467435

view details

stevapple

commit sha fa6a8eceff308402420c3d3b559f9cdf2160b4cc

[test] Fix line-directive on Windows

view details

Holly Borla

commit sha 1f426773eed1bbed59dfdbbcc4288e92454b2b07

[Property Wrappers] Lower assign_by_wrapper to re-assignment of the backing property wrapper before all of self is initialized if the wrapper has already been initialized.

view details

Saleem Abdulrasool

commit sha bdb3da805cdafd3276b08ac6201668ef427ca63d

Frontend: allow directory layout for Swift on non-Darwin platforms Adjust the serialized module loader to allow directory layouts for the Swift module on non-Darwin targets, unifying the layout across all the platforms. It also eases cross-architecture and cross-platform development by having the same layout, which can enable more similar flag usage.

view details

Egor Zhdan

commit sha b63dbbc3f04184f78218fe74d7968bf22e7d4e1d

WinSDK: extract Internationalization submodule Currently winnls.h & imm.h get included into `WinSDK.WinSock2`, however their usages might not be related to sockets

view details

Saleem Abdulrasool

commit sha af868e5c8fc2ed5728618a7a8ab53cf463c0b49b

build: migrate towards the unified directory layout for modules This changes the install layout to be similar across Darwin and non-Darwin platforms. This will enable simplifying the user experience, build infrastructure, and the driver as the SDK layout converges towards a single layout on all the platforms.

view details

Max Desiatov

commit sha 0c8b86601c9ac23a0e7f9e09c8371601b508542c

test: Replace _silgen_name w/ _cdecl in CommandLineStressTest This test abuses @_silgen_name unnecessarily according to https://forums.swift.org/t/how-can-my-c-main-function-call-swift/40244/2

view details

Dave Lee

commit sha 157505196ada10528d2f6a221f1fed25ddfe50d8

[build-script] Disable pkg-config for Darwin hosts

view details

Egor Zhdan

commit sha 62b56f3adcaf046e4447eccdd1af156cfa94e020

WinSDK: extract Controls submodule Currently commdlg.h gets included into `WinSDK.WinSock2`, however its usages might not be related to sockets

view details

Joe Groff

commit sha 023066c1966c63ab3b7a4baee31ac24d29b7de36

SILGen: Relax assertion that incorrectly tripped on lowered opaque capture types. When lowering the SILConstantInfo for a closure implementation type with captures, we are more conservative about substituting opaque types in the capture, since the underlying types may only be available in the local context. This means the SILConstantInfo type may not in fact be exactly what you get from `SILFunction::getFunctionTypeInContext` referencing the implementation function from its originating context, since those opaque types will be substituted in the local context. Fixes SR-13480 | rdar://problem/68159831.

view details

vermont42

commit sha c311e451951b28afacebae69107cef28e4af9e44

Implements SR-11580

view details

Michael Gottesman

commit sha 5717d8713a6735370ae6e6269ea1305c2f39e4d4

[build-script-impl] Add a comment explaining why an option isn't truly dead as per reviewers suggestion. In the original revert, this option was used in two places and I added a comment only on the first one. This copies the comment onto the second usage of the option. Thanks to @edymtt and @compnerd for catching my careless error!

view details

Dave Lee

commit sha 0c79763b332c720869122c4bea1e767356e8024f

[build-script] Cleanup source directory layout help

view details

Dave Lee

commit sha 7168d18e1447e627c42242b82f9f3b6a82321ab7

s/true/false/

view details

swift-ci

commit sha b96eb1d6a424161b1eafe4ae3dd16faa32549d8b

Merge pull request #33905 from apple/dl/build-script-Cleanup-source-directory-layout-help

view details

Meghana Gupta

commit sha 581f6111951a3be65a8a4fdb1433362729e55f07

ARCSequenceOpts: Add LoopSummary verifier (#33810) ARCSequenceOpts with loop support works on regions inside out. While processing an outer region, it uses summary from the inner loop region to compute RefCountState transitions used for CodeMotionSafe optimization. We do not compute the loop summary by iterating over it twice or iterating until a fixed point is reached. Instead loop summary is just a list of refcount effecting instructions. And BottomUpRefCountState::updateForDifferentLoopInst and TopDownRefCountState::updateForDifferentLoopInst are used to compute the RefCountState transition when processing the inner loop region. These functions are very conservative and the flow sensitive nature of the summarized instructions do no matter. This PR adds a verifying assert to confirm this.

view details

push time in 19 days

push eventapple/swift

Meghana Gupta

commit sha 0a21c4d96ff1dab4be29fe4a53b7fdac9d3c6c7d

Fix another use-after-free in SILCombine (#34168) * Fix another use-after-free in SILCombine swift::endLifetimeAtFrontier also needs to use swift::emitDestroyOperation and delete instructions via callbacks that can correctly remove it from the worklist that SILCombine maintains * Add test for use-after-free in SILCombine

view details

push time in 20 days

PR merged apple/swift

Fix another use-after-free in SILCombine

swift::endLifetimeAtFrontier also needs to use swift::emitDestroyOperation and delete instructions via callbacks that can correctly remove it from the worklist that SILCombine maintains.

+39 -12

10 comments

5 changed files

meg-gupta

pr closed time in 20 days

push eventmeg-gupta/swift

Cassie Jones

commit sha 6ef7c1a1c437df2979e96f3e515447e1f47fd8b6

[Localization] Install only *.db and *.yaml files (#34139) This prevents us from picking up the .gitkeep file and any other stray files that might end up in there.

view details

Josh Learn

commit sha b27b8bd492dc98c41756055194cf277cbb8bd85b

[OSLog] Update compiler stubs and tests The compiler stubs for testing the OSLog implementation are in need of an update. This change updates the stubs to be consistent with the current OSLog implementation, updates the existing tests, and adds new tests for String and metatype interpolations. rdar://69719729

view details

Robert Widmann

commit sha 9f69b5140f533aba5d42ab33b823bc23616b4b3f

Remove Type Body Fingerprints Flags This infrastructure has more than proven itself. Drop the code paths and tests supporting the status quo.

view details

Robert Widmann

commit sha e75878a29cd76e2e18d52d8a342d9bb59dc57ff3

Drop "Private Deps" Flag In order for type body fingerprints to work, these declarations must always be included. Drop the ability to turn this off.

view details

Joe Groff

commit sha 46be7f239fe5a501299b2b5b7552403d12201804

SIL: Add instructions to represent async suspend points. `get_async_continuation[_addr]` begins a suspend operation by accessing the continuation value that can resume the task, which can then be used in a callback or event handler before executing `await_async_continuation` to suspend the task.

view details

Slava Pestov

commit sha 7fc57ed7183aef2d015393b285fb45ce9438e3a4

AST: Find local property wrappers in ASTScope::lookupLocalDecls() Two fixes here: - The ASTScopeDeclConsumerForLocalLookup needs to visit auxiliary variables - preCheckExpression() should call ASTScope::lookupLocalDecls() even when parser lookup is enabled, since otherwise we won't be able to find auxiliary decls in the current DeclContext.

view details

Xi Ge

commit sha 16cbc7f7c21d82088a60b23a8083277e50ccc498

Driver: forwarding driver invocations to the new driver when SWIFT_USE_NEW_DRIVER is defined This allows us to experiment with the new swift-driver without changing build systems.

view details

Fero

commit sha 237ce9d449d5444ff9e5d2360577869f33e4234c

Fix typo

view details

Fero

commit sha 21dccc2dc7cfc236fa650641c301a5045b29dcb2

Fix typo

view details

Erik Eckstein

commit sha 17f63461f448bb1c310259405a4b2ac8995e860f

tests: correct availability checks in Interpreter/runtime_name_local_class_opaque_type.swift The test checks a fix, which also affects the runtime. Therefore, the test requires a minimum OS version to run without a crash.

view details

Saleem Abdulrasool

commit sha 1d34d07524e530f45ecbf8ce5f181589e9e3b46f

test: repair the Windows CI host after #34142

view details

Slava Pestov

commit sha 2a6e900c190e95eff8ced01a4aa4dd808e7036d0

Parse: Disable circular definition check when parser lookup is off

view details

Slava Pestov

commit sha 78c6547df31cc865a311e1de2e94505236ca446e

ASTScope: Move sortBySourceRange() and cull() calls out of addSiblingsToScopeTree()

view details

Slava Pestov

commit sha 27c3a4cfba4475052e4b5f2dd79f4f68a0e7a62c

ASTScope: Push isLocalBinding down from AbstractPatternEntryScope to PatternEntryDeclScope

view details

Slava Pestov

commit sha 2d859281a0934210e0eeeb58943f8d667d4be3bb

ASTScope: Directly calculate end location of GuardStmtScope and PatternEntryDeclScope Today, the reported source range of a GuardStmtScope is just that of the statement itself, ending after the 'else' block. Similarly, a PatternEntryDeclScope ends immediately after the initializer expression. Since these scopes introduce names until the end of the parent BraceStmt (meaning they change the insertion point), we were relying on the addition of child scopes to extend the source range. While we still need the hack for extending source ranges to deal with string interpolation, at least in the other cases we can get rid of it. Note that this fixes a bug where a GuardStmtScope would end before an inactive '#if' block if the inactive '#if' block was the last element of a BraceStmt.

view details

Slava Pestov

commit sha 1546245d2ffd3c33382fa00a335b778c2fd62590

Sema: Diagnose duplicate capture list entires when parser lookup is off Another spot where we have to check for redeclaration manually now. As before, we can use the existing mechanism though.

view details

Slava Pestov

commit sha ddf1929b00c29e6472b14fba52d267a83352d82b

Frontend: Add -enable-parser-lookup flag This is for re-enabling it once it is turned off by default.

view details

Slava Pestov

commit sha d46a505e5d8c232dba63581bcc8c6925c07d930d

Update tests in preparation for disabling parser lookup I created a second copy of each test where the output changes after disabling parser lookup. The primary copy now explicitly calls the frontend with -disable-parser-lookup and expects the new diagnostics; the *_parser_lookup.swift version calls the frontend with -enable-parser-lookup and has the old expectations. This allows us to turn parser lookup on and off by default without disturbing tests. Once parser lookup is completely removed we can remove the *_parser_lookup.swift variants.

view details

Egor Zhdan

commit sha d772133d8abc7f10f3be568b25fb54686ced3270

WinSDK: extract System submodule with winioctl.h Currently this header gets included into `WinSDK.WinSock2` via windows.h & winscard.h

view details

John McCall

commit sha fc05a347c96514c585d16261b9afb646e893554f

[NFC] Split ProtocolDispatchStrategy out of MetadataValues.h. This allows us to avoid rebuilding most of the compiler whenever we add a new ABI constant.

view details

push time in 20 days

push eventapple/swift

Meghana Gupta

commit sha 141b032e7c6ad24133905b35a6080f872feb7dac

Enable --build-sil-debugging-stdlib for all of swift/stdlib/public (#34197) Previously it was enable only for swift/stdlib/public/core

view details

push time in 20 days

PR merged apple/swift

Enable --build-sil-debugging-stdlib for all of swift/stdlib/public

Previously it was enable only for swift/stdlib/public/core

+5 -5

1 comment

2 changed files

meg-gupta

pr closed time in 20 days

pull request commentapple/swift

Fix another use-after-free in SILCombine

@swift-ci smoke test Linux Platform

meg-gupta

comment created time in 20 days

pull request commentapple/swift

Fix another use-after-free in SILCombine

@swift-ci smoke test

meg-gupta

comment created time in 21 days

push eventmeg-gupta/swift

Meghana Gupta

commit sha 499c32ab1e71586e81376bce011d2eb1bfa49256

Add test for use-after-free in SILCombine

view details

push time in 21 days

pull request commentapple/swift

Enable --build-sil-debugging-stdlib for all of swift/stdlib/public

@swift-ci smoke test

meg-gupta

comment created time in 21 days

PR opened apple/swift

Enable --build-sil-debugging-stdlib for all of swift/stdlib/public

Previously it was enable only for swift/stdlib/public/core

+5 -5

0 comment

2 changed files

pr created time in 21 days

create barnchmeg-gupta/swift

branch : enablesildebugforallpublic

created branch time in 21 days

push eventapple/swift

Meghana Gupta

commit sha f4bbafb392d838746f4de60d98aa655efff04c8e

Revert "[PassManager] Update PassManager's function worklist for newly added SILFunctions"

view details

Meghana Gupta

commit sha f9ebee2e3b1d6f4eee0cc552a152f970c2b3ee74

Merge pull request #34188 from apple/revert-30710-bottomupfunction Revert "[PassManager] Update PassManager's function worklist for newly added SILFunctions" For some programs which create large number of specialized functions each with deep call chains. This can cause redundant DFS leading to large compile times. Reverting this until we implement a better incremental DFS for updating the bottom up order of newly added functions.

view details

push time in 21 days

delete branch apple/swift

delete branch : revert-30710-bottomupfunction

delete time in 21 days

PR merged apple/swift

Revert "[PassManager] Update PassManager's function worklist for newly added SILFunctions"

Reverts apple/swift#30710

For some programs which create large number of specialized functions each with deep call chains. This can cause redundant DFS leading to large compile times. Reverting this until we implement a better incremental DFS for updating the bottom up order of newly added functions.

+21 -62

4 comments

5 changed files

meg-gupta

pr closed time in 21 days

pull request commentapple/swift

Revert "[PassManager] Update PassManager's function worklist for newly added SILFunctions"

@swift-ci smoke test Linux Platform

meg-gupta

comment created time in 21 days

pull request commentapple/swift

Revert "[PassManager] Update PassManager's function worklist for newly added SILFunctions"

@swift-ci smoke test Linux Platform

meg-gupta

comment created time in 21 days

more