-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
JIT Optimization: Eliminate duplicate bswap
#66249
Comments
Tagging subscribers to this area: @JulieLeeMSFT Issue DetailsAn Reproduction: https://godbolt.org/z/KMEn8bYsc Expected diff mov eax, edx
- bswap eax
- bswap eax
ret
|
As we discussed in the Discord - this optimization looks super niche |
I asked in the LLVM reviews what the real-world case is (See D6407: [InstCombine] Minor optimization for bswap with binary ops). |
In the future, please only open issues when the real-world use case is known. Thanks. |
Closing now. Let's reopen this issue when there is a real world case. |
The main reason to merge this into LLVM was the ARGB - RGBA Pixel Code Swizzling (see LLVM Phabricator conversation) I could imagine that this problem might occur with the API proposal #48615. Tanner do you think the ARGB-RGB Pixel Swizzling could be a hot path for certain use cases (e.g. WinForms)? If so, the optimization would not be so bad in my opinion. /cc @RKSimon |
no, “this” has nothing common with that LLVM review. Two different transformations. |
An
bswap
swaps the endianess. If we emit anbswap
twice we get back to the initial state, so this can be optimized (similar to what GCC and Clang do).Reproduction: https://godbolt.org/z/KMEn8bYsc
Expected diff
The text was updated successfully, but these errors were encountered: