diff options
author | Sanjay Patel <spatel@rotateright.com> | 2023-02-19 10:33:30 -0500 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2023-02-19 17:29:40 -0500 |
commit | 8e8467d9d8033e22a98aec3bc20969bd3a59ab28 (patch) | |
tree | d51a6782e226d7b0dd62fda7f98ee96fbd50176d /llvm/lib/CodeGen/MachineModuleInfoImpls.cpp | |
parent | 87d02e0dfd760de38d092ef69f8a9164f28f2221 (diff) | |
download | llvm-8e8467d9d8033e22a98aec3bc20969bd3a59ab28.zip llvm-8e8467d9d8033e22a98aec3bc20969bd3a59ab28.tar.gz llvm-8e8467d9d8033e22a98aec3bc20969bd3a59ab28.tar.bz2 |
[InstCombine] canonicalize "extract lowest set bit" away from cttz intrinsic
1 << (cttz X) --> -X & X
https://alive2.llvm.org/ce/z/qv3E9e
This creates an extra use of the input value, so that's generally
not preferred, but there are advantages to this direction:
1. 'negate' and 'and' allow for better analysis than 'cttz'.
2. This is more likely to induce follow-on transforms (in the
example from issue #60801, we'll get the decrement pattern).
3. The more basic ALU ops are more likely to result in better
codegen across a variety of targets.
This won't solve the motivating bugs (see issue #60799) because
we do not recognize the redundant icmp+sel, and the x86 backend
may not have the pattern-matching to produce the optimal BMI
instructions.
Differential Revision: https://reviews.llvm.org/D144329
Diffstat (limited to 'llvm/lib/CodeGen/MachineModuleInfoImpls.cpp')
0 files changed, 0 insertions, 0 deletions