[llvm] [llubi] Implement memory manipulation intrinsics (PR #204932)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 22 06:23:26 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);
----------------
dtcxzyw wrote:
The align attribute is checked by `enterCall -> handleAttributes`. But it would be nice to have a negative test here.
https://github.com/llvm/llvm-project/pull/204932
More information about the llvm-commits
mailing list