[llvm] [RISCVISel] Compute leading zeros for RISCVISD::VCPOP_VL node (PR #127705)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 18 14:16:55 PST 2025


================
@@ -19462,6 +19462,11 @@ void RISCVTargetLowering::computeKnownBitsForTargetNode(const SDValue Op,
     Known = Known.intersectWith(Known2);
     break;
   }
+  case RISCVISD::VCPOP_VL: {
+    KnownBits Known2 = DAG.computeKnownBits(Op.getOperand(2), Depth + 1);
+    Known.Zero.setBitsFrom(Known2.countMaxTrailingZeros());
----------------
topperc wrote:

This isn't correct. It would need `Known.Zero.setBitsFrom(Known2.countMaxActiveBits());`

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


More information about the llvm-commits mailing list