[llvm] [RISCV] Implement computeKnownBitsForTargetNode for SHL_ADD (PR #159105)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 16 10:08:27 PDT 2025


================
@@ -21561,6 +21561,15 @@ void RISCVTargetLowering::computeKnownBitsForTargetNode(const SDValue Op,
     Known = Known.sext(BitWidth);
     break;
   }
+  case RISCVISD::SHL_ADD: {
+    KnownBits Known2;
+    Known = DAG.computeKnownBits(Op.getOperand(0), DemandedElts, Depth + 1);
+    Known2 = DAG.computeKnownBits(Op.getOperand(1), DemandedElts, Depth + 1);
----------------
topperc wrote:

Oh, but then I guess you can't use KnownBits::shl. So you'll have to use `Known >>= ShAmt; Known.Zero.setHighBits(ShAmt);`

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


More information about the llvm-commits mailing list