[llvm] [llubi] Implement memory manipulation intrinsics (PR #204932)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 22 03:25:12 PDT 2026


================
@@ -698,6 +699,120 @@ class InstExecutor : public InstVisitor<InstExecutor, void>,
     return V.asInteger();
   }
 
+  AnyValue callMemTransferIntrinsic(ArrayRef<AnyValue> Args,
+                                    Intrinsic::ID IID) {
+    if (Args[2].isPoison()) {
+      reportImmediateUB() << "Memory transfer intrinsic with poison length.";
+      return AnyValue::poison();
+    }
+
+    const APInt &Length = Args[2].asInteger();
+    if (Length.getActiveBits() > 64) {
+      reportImmediateUB()
+          << "Memory transfer intrinsic length overflows uint64_t.";
+      return AnyValue::poison();
+    }
+
+    const uint64_t Len = Length.getZExtValue();
+    if (Len == 0)
+      return AnyValue();
+
+    if (Args[0].isPoison()) {
+      reportImmediateUB()
+          << "Memory transfer intrinsic with poison destination pointer.";
+      return AnyValue::poison();
+    }
+
+    if (Args[1].isPoison()) {
+      reportImmediateUB()
+          << "Memory copy intrinsic with poison source pointer.";
+      return AnyValue::poison();
+    }
+
+    const Pointer &DstPtr = Args[0].asPointer();
+    const Pointer &SrcPtr = Args[1].asPointer();
+
+    auto [SrcMO, SrcOffset] =
+        verifyMemAccess(SrcPtr, Len, Align(1), /*IsStore=*/false);
----------------
antoniofrighetto wrote:

(If this is supposed to be done in the current iteration of the work.)

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


More information about the llvm-commits mailing list