[llvm] [InstCombine] Extend `(lshr/shl (shl/lshr -1, x), x)` -> `(lshr/shl -1, x)` for multi-use (PR #81576)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 13 09:24:21 PST 2024


================
@@ -1206,6 +1206,12 @@ Instruction *InstCombinerImpl::visitShl(BinaryOperator &I) {
     return BinaryOperator::CreateAnd(Mask, X);
   }
 
+  // Transform  (-1 >> y) << y  to -1 << y
+  if (match(Op0, m_LShr(m_AllOnes(), m_Specific(Op1)))) {
----------------
nikic wrote:

Oh duh, you're right.

https://github.com/llvm/llvm-project/pull/81576


More information about the llvm-commits mailing list