Skip to content

MultiDefPrunedLiveness: add support for arbitrary uses/defs. #64926

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 5, 2023

Conversation

atrick
Copy link
Contributor

@atrick atrick commented Apr 4, 2023

This now supports liveness holes within blocks where previously we
expected a phi def.

PrunedLiveness is streamlined for SSA liveness where we expect the
defs and uses to be related in the SSA def-use graph.
MultiDefPrunedLiveness was added on top of SSAPrunedLivenes to handle
extended SSA liveness that occurs with phis, but are still connected
in the def-use graph. Recently MultiDefPrunedLiveness was repurposed
for liveness of addressible storage. This means that we can now have
uses before defs in the same block without a corresponding phi.

Fortunately, handling this case is a straightforward extension of
MultiDefPrunedLiveness that does not complicate or penalize the
streamlined SSA case.

Restores PR: MultiDefPrunedLiveness: add support for arbitrary uses/defs. #64625
The CI failure in watchos RemoveWhere.o appears unrelated:
rdar://107341949 (Swift CI: [main, armv7k] benchmark/O-armv7k-apple-watchos2.0/RemoveWhere.o: assert in Control Flow Optimizer)

atrick added 5 commits April 4, 2023 10:22
This was recently introduced as a result of rebasing commits. It never
did anything useful on the main branch.
PrunedLiveness only knows about the live blocks and uses.

The PrunedLiveRange subclass is now responsible for updating liveness
based on both the defs and uses. This is in preparation for handling
non-SSA liveness when uses occur before the first def.
This now supports liveness holes within blocks where previously we
expected a phi def.

PrunedLiveness is streamlined for SSA liveness where we expect the
defs and uses to be related in the SSA def-use graph.
MultiDefPrunedLiveness was added on top of SSAPrunedLivenes to handle
extended SSA liveness that occurs with phis, but are still connected
in the def-use graph. Recently MultiDefPrunedLiveness was repurposed
for liveness of addressible storage. This means that we can now have
uses before defs in the same block without a corresponding phi.

Fortunately, handling this case is a straightforward extension of
MultiDefPrunedLiveness that does not complicate or penalize the
streamlined SSA case.
@atrick
Copy link
Contributor Author

atrick commented Apr 4, 2023

preset=buildbot_incremental,tools=RA,stdlib=RA
@swift-ci Please test with preset macOS

@atrick
Copy link
Contributor Author

atrick commented Apr 4, 2023

@swift-ci test

@atrick
Copy link
Contributor Author

atrick commented Apr 4, 2023

@swift-ci benchmark

@atrick
Copy link
Contributor Author

atrick commented Apr 4, 2023

@swift-ci test source compatibility

@atrick
Copy link
Contributor Author

atrick commented Apr 5, 2023

Building with the incremental preset failed in a SwiftPM test unrelated to this change:

    "Test Case '-[CommandsTests.BuildToolTests testAtMainSupport]' failed (21.408 seconds).
Test Suite 'BuildToolTests' failed at 2023-04-05 03:01:29.771.
	 Executed 1 test, with 1 failure (1 unexpected) in 21.408 (21.408) seconds
Test Suite 'SwiftPMPackageTests.xctest' failed at 2023-04-05 03:01:29.772.
	 Executed 1 test, with 1 failure (1 unexpected) in 21.408 (21.408) seconds
Test Suite 'Selected tests' failed at 2023-04-05 03:01:29.772.
	 Executed 1 test, with 1 failure (1 unexpected) in 21.408 (21.408) seconds**** FAILURE EXECUTING SUBPROCESS ****

@atrick
Copy link
Contributor Author

atrick commented Apr 5, 2023

Source compat suite fails to build Doggie on main in SILGen. No new failures here.

Assertion failed: ((sig && sig->isEqual(subs.getGenericSignature())) || !OrigType || !OrigType->hasTypeParameter()), function withSubstitutions, file AbstractionPattern.h, line 1099.

4.	While silgen emitFunction SIL function "@$s10DoggieCore12MappedBufferV6append10contentsOfyqd___t7ElementQyd__RszSTRd__lF".
 for 'append(contentsOf:)' (at /Users/ec2-user/jenkins/workspace/swift-main-source-compat-suite/swift-source-compat-suite/project_cache/Doggie/Sources/DoggieCore/Foundation/MappedBuffer.swift:270:21)
5.	While silgen emitFunction SIL function "@$s10DoggieCore12MappedBufferV6append10contentsOfyqd___t7ElementQyd__RszSTRd__lF01_E0L_yyqd0__AGRszSTRd__STRd0__AFQyd0__AGRSr___lF".
 for '_append(_:)' (at /Users/ec2-user/jenkins/workspace/swift-main-source-compat-suite/swift-source-compat-suite/project_cache/Doggie/Sources/DoggieCore/Foundation/MappedBuffer.swift:287:9):
    swift-frontend           0x00000001092cc793 swift::Lowering::AbstractionPattern::withSubstitutions(swift::SubstitutionMap) con

Copy link
Contributor

@nate-chandler nate-chandler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@atrick atrick merged commit 4bc9671 into swiftlang:main Apr 5, 2023
@atrick atrick deleted the fix-liveblocks branch April 5, 2023 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants