[llvm] [NVPTX] Implement computeKnownBitsForTargetNode for LoadV2/4 (PR #154165)

Kevin McAfee via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 20 11:28:27 PDT 2025


================
@@ -6609,6 +6538,26 @@ static void computeKnownBitsForPRMT(const SDValue Op, KnownBits &Known,
   }
 }
 
+static void computeKnownBitsForVLoad(const SDValue Op, KnownBits &Known) {
+  MemSDNode *LD = cast<MemSDNode>(Op);
+
+  // We can't do anything without knowing the sign bit.
+  auto ExtType = LD->getConstantOperandVal(LD->getNumOperands() - 1);
+  if (ExtType == ISD::SEXTLOAD)
+    return;
+
+  // ExtLoading to vector types is weird and may not work well with known bits.
+  auto DestVT = LD->getValueType(0);
+  if (DestVT.isVector())
+    return;
+
+  assert(Known.getBitWidth() == DestVT.getSizeInBits());
+  auto ElementBitWidth = NVPTXDAGToDAGISel::getFromTypeWidthForLoad(LD);
+  KnownBits HighZeros(Known.getBitWidth() - ElementBitWidth);
+  HighZeros.setAllZero();
+  Known.insertBits(HighZeros, ElementBitWidth);
----------------
kalxr wrote:

Fixed

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


More information about the llvm-commits mailing list