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

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 16 08:45:39 PDT 2017


spatel added inline comments.


================
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;
----------------
efriedma wrote:
> `(~*Mask).shl(*ShAmt).isNullValue()`?  Not sure that's better.
Looks better to me - we can use the inverted mask for both cases to make things symmetrical.
That also makes it easier to write the Alive tests:
http://rise4fun.com/Alive/lY0


https://reviews.llvm.org/D33221





More information about the llvm-commits mailing list