diff options
author | Sanjay Patel <spatel@rotateright.com> | 2022-03-22 09:02:28 -0400 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2022-03-22 09:10:55 -0400 |
commit | 60820e53ec9d3be028ce315f9b630b55c670b32e (patch) | |
tree | 43b29264e6e9eb6da85f4e417cd31c1e312b797b /clang/lib/Frontend/InitPreprocessor.cpp | |
parent | 91ea247039dbcc756107616d39baecbb3a4bfb7e (diff) | |
download | llvm-60820e53ec9d3be028ce315f9b630b55c670b32e.zip llvm-60820e53ec9d3be028ce315f9b630b55c670b32e.tar.gz llvm-60820e53ec9d3be028ce315f9b630b55c670b32e.tar.bz2 |
[InstCombine] try to canonicalize logical shift after bswap
When shifting by a byte-multiple:
bswap (shl X, C) --> lshr (bswap X), C
bswap (lshr X, C) --> shl (bswap X), C
This is an IR implementation of a transform suggested in D120648.
The "swaps cancel" test models the motivating optimization from
that proposal.
Alive2 checks (as noted in the other review, we could use
knownbits to handle shift-by-variable-amount, but that can be an
enhancement patch):
https://alive2.llvm.org/ce/z/pXUaRf
https://alive2.llvm.org/ce/z/ZnaMLf
Differential Revision: https://reviews.llvm.org/D122010
Diffstat (limited to 'clang/lib/Frontend/InitPreprocessor.cpp')
0 files changed, 0 insertions, 0 deletions