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

Alex MacLean via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 18 18:50:43 PDT 2025


================
@@ -6609,6 +6537,27 @@ static void computeKnownBitsForPRMT(const SDValue Op, KnownBits &Known,
   }
 }
 
+static void computeKnownBitsFori8VLoad(const SDValue Op, KnownBits &Known) {
+  MemSDNode *Mem = dyn_cast<MemSDNode>(Op);
+  if (!Mem) {
+    return;
+  }
+
+  EVT MemVT = Mem->getMemoryVT();
+  if (MemVT != MVT::v2i8 && MemVT != MVT::v4i8) {
+    return;
+  }
+
+  unsigned ExtType = Mem->getConstantOperandVal(Mem->getNumOperands() - 1);
+  if (ExtType == ISD::SEXTLOAD) {
+    Known = Known.sext(Known.getBitWidth());
+    return;
+  }
----------------
AlexMaclean wrote:

This bit confuses me. Why would we `sext` `Known` to the width it already is? Won't this always be a no-op? I think if this a `SEXTLOAD` we can't do anything since we don't have any info at all about what the high bit of the value loaded from memory is. 

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


More information about the llvm-commits mailing list