[llvm] [DirectX] Legalize memcpy (PR #139173)

Deric C. via llvm-commits llvm-commits at lists.llvm.org
Thu May 15 12:59:42 PDT 2025


================
@@ -246,6 +246,61 @@ downcastI64toI32InsertExtractElements(Instruction &I,
   }
 }
 
+static void emitMemcpyExpansion(IRBuilder<> &Builder, Value *Dst, Value *Src,
+                                ConstantInt *Length) {
+
+  uint64_t ByteLength = Length->getZExtValue();
+  if (ByteLength == 0)
+    return;
+
+  LLVMContext &Ctx = Builder.getContext();
+  const DataLayout &DL = Builder.GetInsertBlock()->getModule()->getDataLayout();
+
+  auto GetArrTyFromVal = [](Value *Val) -> ArrayType * {
----------------
Icohedron wrote:

If you are talking about the type of `GetArrTyFromVal`, it is a lambda function so I think it has to be an `auto`.
If you are talking about the return type of the lambda function (`-> Array Type *`), the return statements all explicitly return a `dyn_cast<ArrayType>` and all its uses expect an `ArrayType *`, so `ArrayType *` is the most appropriate.

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


More information about the llvm-commits mailing list