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

via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 13 09:15:32 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)))) {
----------------
goldsteinn wrote:

`(ashr -1, x)` will always simplify to -1 on its own. Don't think adding support here for ashr would ever actually come into play

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


More information about the llvm-commits mailing list