[llvm] [IR] Initial introduction of memset_pattern (PR #97583)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 14 05:10:04 PDT 2024
================
@@ -456,6 +456,56 @@ static void createMemMoveLoop(Instruction *InsertBefore, Value *SrcAddr,
ElseTerm->eraseFromParent();
}
+static void createMemSetPatternLoop(Instruction *InsertBefore, Value *DstAddr,
+ Value *Count, Value *SetValue,
+ Align DstAlign, bool IsVolatile) {
+ BasicBlock *OrigBB = InsertBefore->getParent();
+ Function *F = OrigBB->getParent();
+ const DataLayout &DL = F->getDataLayout();
+
+ if (DL.isBigEndian())
+ report_fatal_error("memset.pattern expansion not currently "
+ "implemented for big-endian targets",
+ false);
+
+ if (!isPowerOf2_32(SetValue->getType()->getScalarSizeInBits()))
+ report_fatal_error("Pattern width for memset_pattern must be a power of 2",
+ false);
----------------
nikic wrote:
This limitation would have to be checked by the IR verifier. I don't think it's needed though, your code should work fine without it.
https://github.com/llvm/llvm-project/pull/97583
More information about the llvm-commits
mailing list