[PATCH] D33221: [InstSimplify] add folds for constant mask of value shifted by constant

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 15 18:59:50 PDT 2017


efriedma added a comment.

We don't want to write out a bunch of patterns here which are completely redundant, but this pattern in particular is likely to come up in code involving bitfields, so it seems fine.



================
Comment at: lib/Analysis/InstructionSimplify.cpp:1770
+    if (match(Op0, m_LShr(m_Value(X), m_APInt(ShAmt))) &&
+        Mask->shl(*ShAmt).ashr(*ShAmt).isAllOnesValue())
+      return Op0;
----------------
`(~*Mask).shl(*ShAmt).isNullValue()`?  Not sure that's better.


https://reviews.llvm.org/D33221





More information about the llvm-commits mailing list