Skip to content

Add @_transparent to some more Integer operations #80712

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 1 commit into from
Apr 19, 2025

Conversation

meg-gupta
Copy link
Contributor

@meg-gupta meg-gupta commented Apr 10, 2025

#79707 made some integer operations transparent enabling them to be inlined during MandatoryInlining. With this OSLogOptimization needs to analyze the inlined function bodies of these integer operations since it runs after MandatoryInlining.

In certain configurations, stdlib's FixedWidthInteger.bitwidth and others are not inlined and OSLogOptimization misses to determine these calls as constants.

OSLogOptimization can look through calls to functions annotated with @_semantics(constant_evaluable).
But annotating with @_semantics(constant_evaluable) seems to require annotating with @_optimize(none). Instead annotate with @_transparent.

Fixes oslog tests when stdlib is built with -Osize/-Onone - rdar://148256435 and rdar://148302110

@meg-gupta meg-gupta requested a review from a team as a code owner April 10, 2025 11:00
@meg-gupta
Copy link
Contributor Author

@swift-ci test

@_transparent will ensure there are inlined in MandatoryInlining which runs before OSLogOptimization.

OSLogOptimization does not look through their calls because they are not marked with
@_semantics("constant_evaluable") which requires them to also be annotated as @_optimize(none)

rdar://148256435
@meg-gupta meg-gupta changed the title Add @_semantics(constant_evaluable) to FixedWidthInteger.bitwidth Apr 10, 2025
@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta
Copy link
Contributor Author

@swift-ci apple silicon benchmark

@meg-gupta
Copy link
Contributor Author

@swift-ci benchmark

@meg-gupta meg-gupta requested a review from eeckstein as a code owner April 10, 2025 19:35
@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta
Copy link
Contributor Author

@swift-ci apple silicon benchmark

@meg-gupta
Copy link
Contributor Author

@swift-ci benchmark

This was referenced Apr 11, 2025
@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta
Copy link
Contributor Author

Benchmark failures are present in baseline.

@meg-gupta meg-gupta merged commit a0fc6e2 into swiftlang:main Apr 19, 2025
5 of 6 checks passed
This was referenced Apr 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants