@@ -25,6 +25,8 @@ void llvm::createMemCpyLoopKnownSize(
2525 ConstantInt *CopyLen, Align SrcAlign, Align DstAlign, bool SrcIsVolatile,
2626 bool DstIsVolatile, bool CanOverlap, const TargetTransformInfo &TTI,
2727 std::optional<uint32_t > AtomicElementSize) {
28+ assert (!InsertBefore->getModule ()->getDataLayout ().hasCheriCapabilities () &&
29+ " Should not expand memcpy in IR for CHERI until hooks are updated" );
2830 // No need to expand zero length copies.
2931 if (CopyLen->isZero ())
3032 return ;
@@ -180,6 +182,8 @@ void llvm::createMemCpyLoopUnknownSize(
180182 Align SrcAlign, Align DstAlign, bool SrcIsVolatile, bool DstIsVolatile,
181183 bool CanOverlap, const TargetTransformInfo &TTI,
182184 std::optional<uint32_t > AtomicElementSize) {
185+ assert (!InsertBefore->getModule ()->getDataLayout ().hasCheriCapabilities () &&
186+ " Should not expand memcpy in IR for CHERI until hooks are updated" );
183187 BasicBlock *PreLoopBB = InsertBefore->getParent ();
184188 BasicBlock *PostLoopBB =
185189 PreLoopBB->splitBasicBlock (InsertBefore, " post-loop-memcpy-expansion" );
@@ -381,6 +385,8 @@ static void createMemMoveLoop(Instruction *InsertBefore, Value *SrcAddr,
381385 Align DstAlign, bool SrcIsVolatile,
382386 bool DstIsVolatile,
383387 const TargetTransformInfo &TTI) {
388+ assert (!InsertBefore->getModule ()->getDataLayout ().hasCheriCapabilities () &&
389+ " Should not expand memcpy in IR for CHERI until hooks are updated" );
384390 Type *TypeOfCopyLen = CopyLen->getType ();
385391 BasicBlock *OrigBB = InsertBefore->getParent ();
386392 Function *F = OrigBB->getParent ();
0 commit comments