[PATCH] D49229: [InstCombine] Fold redundant masking operations of shifted value
Diogo N. Sampaio via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 24 08:36:39 PDT 2018
dnsampaio marked 2 inline comments as done.
dnsampaio added inline comments.
================
Comment at: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:2026-2036
+ // 1st: Check for desired pattern
+ if (match(&I, m_c_Or(m_And(m_OneUse(m_Shift(m_Value(X), m_APInt(ShftAmt))),
+ m_APInt(ShAndC)),
+ m_And(m_Deferred(X), m_APInt(AndC))))) {
+ // 2nd: Find out which AND is which
+ BinaryOperator *And = cast<BinaryOperator>(A), *Shift, *ShtAnd;
+ if (And->getOperand(0) != X) {
----------------
lebedev.ri wrote:
> See `m_CombineAnd()`.
Nice one, it took me some time to understand that I could match and then capture. Thanks. :)
https://reviews.llvm.org/D49229
More information about the llvm-commits
mailing list