[llvm] [DirectX] Legalize memcpy (PR #139173)
Finn Plummer via llvm-commits
llvm-commits at lists.llvm.org
Fri May 9 11:56:51 PDT 2025
================
@@ -246,6 +247,59 @@ 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) {
+ if (auto *Alloca = dyn_cast<AllocaInst>(Val))
+ return dyn_cast<ArrayType>(Alloca->getAllocatedType());
+ if (auto *GlobalVar = dyn_cast<GlobalVariable>(Val))
+ return dyn_cast<ArrayType>(GlobalVar->getValueType());
+ llvm_unreachable(
----------------
inbelic wrote:
nit: Maybe an assert is better? This code path will be triggered if say `Val` is a ptr from, say, the function args or a gep. So I do think it is reachable, just never expected to.
https://github.com/llvm/llvm-project/pull/139173
More information about the llvm-commits
mailing list