-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[opt] Teach mem2reg about begin_access. #30812
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
Conversation
@swift-ci please benchmark. |
I suspect that there won't be significant improvement because mem2reg only optimizes tuples and structs and those rarely have access markers around them or their members. |
@swift-ci please benchmark |
Performance: -O
Code size: -OPerformance: -Osize
Code size: -OsizePerformance: -OnoneCode size: -swiftlibsHow to read the dataThe tables contain differences in performance which are larger than 8% and differences in code size which are larger than 1%.If you see any unexpected regressions, you should consider fixing the Noise: Sometimes the performance results (not code size!) contain false Hardware Overview
|
Now that #34276 has landed, I'm going to try benchmarking this again. |
Mem2reg can now follow, project, and remove being_access instructions.
67cde92
to
1f00e9a
Compare
At some point, it would probably also be good to re-write the patch to use the |
@swift-ci please benchmark. |
1 similar comment
@swift-ci please benchmark. |
Performance: -O
Code size: -OPerformance: -OsizeCode size: -OsizePerformance: -OnoneCode size: -swiftlibsHow to read the dataThe tables contain differences in performance which are larger than 8% and differences in code size which are larger than 1%.If you see any unexpected regressions, you should consider fixing the Noise: Sometimes the performance results (not code size!) contain false Hardware Overview
|
@zoecarver I'm wondering if mem2reg actually needs to handle access instructions. Wouldn't access marker elimination remove those markers anyway? |
I'm surprised to see such a large regression. I wonder what's causing that.
Yes, marker elimination should remove these. I thought that happened later in the pass pipeline than it does. It looks like it happens in the high-level function pipeline, though, so that should be sufficient (which explains why there aren't performance gains here). I was looking at code patterns as simple as:
Because of how early the mem2reg pass runs in the pipeline, it looked like it was getting tripped up on the access markers. |
Mem2reg can now follow, project, and remove being_access instructions. This will be particularly beneficial for #30810.