[llvm] [DirectX] Legalize memcpy (PR #139173)
Farzon Lotfi via llvm-commits
llvm-commits at lists.llvm.org
Thu May 15 10:51:16 PDT 2025
================
@@ -296,6 +351,30 @@ static void emitMemsetExpansion(IRBuilder<> &Builder, Value *Dst, Value *Val,
}
}
+static void removeMemCpy(Instruction &I,
+ SmallVectorImpl<Instruction *> &ToRemove,
+ DenseMap<Value *, Value *> &ReplacedValues) {
+
+ CallInst *CI = dyn_cast<CallInst>(&I);
+ if (!CI)
+ return;
+
+ Intrinsic::ID ID = CI->getIntrinsicID();
+ if (ID != Intrinsic::memcpy)
+ return;
+
+ IRBuilder<> Builder(&I);
+ Value *Dst = CI->getArgOperand(0);
+ Value *Src = CI->getArgOperand(1);
+ ConstantInt *Length = dyn_cast<ConstantInt>(CI->getArgOperand(2));
----------------
farzonl wrote:
Are we sure memcpy will always be a ConstantInt for length? I'm leaning yes because you check the globals are constants?
https://github.com/llvm/llvm-project/pull/139173
More information about the llvm-commits
mailing list