diff options
author | Nikita Popov <npopov@redhat.com> | 2022-05-02 18:21:00 +0200 |
---|---|---|
committer | Nikita Popov <npopov@redhat.com> | 2022-05-03 11:33:27 +0200 |
commit | 47255834e720b735ff1358a74fdf32345bb4daca (patch) | |
tree | 301b774a3d14a687787e49d74f45e02b5054755e /llvm/lib/Support/CommandLine.cpp | |
parent | 6c57b0debedaa5f211a39a8d6765ad4c74db4059 (diff) | |
download | llvm-47255834e720b735ff1358a74fdf32345bb4daca.zip llvm-47255834e720b735ff1358a74fdf32345bb4daca.tar.gz llvm-47255834e720b735ff1358a74fdf32345bb4daca.tar.bz2 |
[ValueTracking] A and (B & ~A) have no common bits set
This extends haveNoCommonBitsSet() to two additional cases, allowing
the following folds:
* `A + (B & ~A)` --> `A | (B & ~A)`
(https://alive2.llvm.org/ce/z/crxxhN)
* `A + ((A & B) ^ B)` --> `A | ((A & B) ^ B)`
(https://alive2.llvm.org/ce/z/A_wsH_)
These should further fold to just `A | B`, though this currently
only works in the first case.
The reason why the second fold is necessary is that we consider
this to be the canonical form if B is a constant. (I did check
whether we can change that, but it looks like a number of folds
depend on the current canonicalization, so I ended up adding both
patterns here.)
Differential Revision: https://reviews.llvm.org/D124763
Diffstat (limited to 'llvm/lib/Support/CommandLine.cpp')
0 files changed, 0 insertions, 0 deletions