[llvm] Missing opt with ctlz and shifts of power of 2 constants (#41333) (PR #74175)

Sizov Nikita via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 7 12:03:18 PST 2023


================
@@ -549,6 +551,36 @@ static Instruction *foldCttzCtlz(IntrinsicInst &II, InstCombinerImpl &IC) {
 
     if (match(Op0, m_Intrinsic<Intrinsic::abs>(m_Value(X))))
       return IC.replaceOperand(II, 0, X);
+
+    // cttz(shl(%const, %val), 1) --> add(cttz(%const, 1), %val)
+    if (match(Op0, m_Shl(m_Constant(C), m_Value(X))) && match(Op1, m_One())) {
----------------
snikitav wrote:

Fixed

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


More information about the llvm-commits mailing list