Skip to content

Conversation

aidan-hall
Copy link
Contributor

@aidan-hall aidan-hall commented Aug 12, 2025

Currently, the compute-side-effects pass does nothing if a function has an effect attribute. This prevents certain optimisations, such as temporary lvalue elimination, from working for callers of such functions.

This is a naive fix, which will worsen the performance of the compute-side-effects pass by making it run of functions it wouldn't have otherwise.

For the test case this patch aims to fix, we only need to compute the isDeinitBarrier property. We could attempt to only store that property, but there is no benefit to this over storing all the computed side effect properties. The benefit of the previous behaviour was avoiding the overhead of computing any properties in the first place.

rdar://155870190

This aims to resolve the same problem as #38324.

@aidan-hall aidan-hall requested a review from eeckstein as a code owner August 12, 2025 14:10
Copy link
Contributor

@eeckstein eeckstein left a comment

Choose a reason for hiding this comment

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

lgtm!

@eeckstein
Copy link
Contributor

@swift-ci test

@eeckstein
Copy link
Contributor

@swift-ci apple silicon benchmark

@aidan-hall
Copy link
Contributor Author

The 1 test failure on the macOS platform doesn't seem to be related to this change (WatchOS version issues), so it should be ok to merge anyway.

@eeckstein
Copy link
Contributor

@swift-ci test macos

@aidan-hall aidan-hall marked this pull request as draft August 14, 2025 10:59
@aidan-hall aidan-hall force-pushed the fix-effects branch 2 times, most recently from 81d6e8b to 8771877 Compare August 15, 2025 11:09
@aidan-hall
Copy link
Contributor Author

@swift-ci apple silicon benchmark

1 similar comment
@MAJKFL
Copy link
Contributor

MAJKFL commented Aug 15, 2025

@swift-ci apple silicon benchmark

@aidan-hall aidan-hall requested a review from eeckstein August 18, 2025 15:37
@aidan-hall
Copy link
Contributor Author

@swift-ci apple silicon benchmark

@aidan-hall
Copy link
Contributor Author

@swift-ci test

1 similar comment
@aidan-hall
Copy link
Contributor Author

@swift-ci test

@aidan-hall
Copy link
Contributor Author

@swift-ci apple silicon benchmark

@aidan-hall aidan-hall marked this pull request as ready for review August 19, 2025 13:34
@aidan-hall
Copy link
Contributor Author

@swift-ci apple silicon benchmark

@aidan-hall
Copy link
Contributor Author

@swift-ci test

@aidan-hall aidan-hall removed the request for review from eeckstein August 19, 2025 14:22
@aidan-hall
Copy link
Contributor Author

@swift-ci smoke test macOS

@aidan-hall
Copy link
Contributor Author

@swift-ci smoke test linux
@swift-ci test windows

@aidan-hall
Copy link
Contributor Author

@swift-ci smoke test linux

@aidan-hall
Copy link
Contributor Author

@swift-ci smoke test macOS

@aidan-hall aidan-hall force-pushed the fix-effects branch 2 times, most recently from 56c78c6 to 8897903 Compare August 21, 2025 17:55
@aidan-hall
Copy link
Contributor Author

@swift-ci smoke test

@aidan-hall
Copy link
Contributor Author

@swift-ci apple silicon benchmark

After computing side effects, we also remove any global or argument effects that
are computed to happen, but are defined not to, based on the effect attribute.

This allows us to compute the deinit_barrier effect for such functions, fixing
the test case here: rdar://155870190

This supercedes swiftlang#38324.
@aidan-hall
Copy link
Contributor Author

@swift-ci smoke test

@aidan-hall aidan-hall requested a review from eeckstein August 22, 2025 11:21
Copy link
Contributor

@eeckstein eeckstein left a comment

Choose a reason for hiding this comment

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

lgtm

@aidan-hall
Copy link
Contributor Author

@swift-ci test windows

@aidan-hall aidan-hall enabled auto-merge August 22, 2025 16:19
@aidan-hall
Copy link
Contributor Author

@swift-ci test windows

@aidan-hall aidan-hall disabled auto-merge August 26, 2025 09:12
@aidan-hall aidan-hall merged commit 53028ab into swiftlang:main Aug 27, 2025
3 checks passed
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.

3 participants