[PATCH] D112338: [InstCombine] Fold `(~(a | b) & c) | ~(a | c)` into `~((b & c) | a)`
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 29 07:35:57 PDT 2021
spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.
LGTM.
The commute tests are not complete, but they should be enough to ensure the pattern-matching won't silently break.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:2822
+ // (~(A | B) & C) | ~(A | C) --> ~((B & C) | A)
+ if (match(Op0, m_OneUse(m_c_And(m_OneUse(m_Not(m_Or(m_Value(A), m_Value(B)))),
+ m_Value(C))))) {
----------------
The use checks aren't what I suggested, but either way, it is overly conservative (and we would see improvements on some of the tests that are currently left unchanged), so please put a TODO comment on this block to suggest we can loosen the use checks.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D112338/new/
https://reviews.llvm.org/D112338
More information about the llvm-commits
mailing list