[Mlir-commits] [mlir] [mlir][llvm] Add support for memset.inline (PR #115711)
Tobias Gysi
llvmlistbot at llvm.org
Mon Nov 11 08:21:05 PST 2024
================
@@ -988,62 +1012,74 @@ bool LLVM::MemsetOp::canUsesBeRemoved(
if (!canConvertType)
return false;
- if (getIsVolatile())
+ if (op.getIsVolatile())
return false;
- return getStaticMemIntrLen(*this) == dataLayout.getTypeSize(slot.elemType);
+ return getStaticMemIntrLen(op) == dataLayout.getTypeSize(slot.elemType);
}
-
-DeletionKind LLVM::MemsetOp::removeBlockingUses(
- const MemorySlot &slot, const SmallPtrSetImpl<OpOperand *> &blockingUses,
- OpBuilder &builder, Value reachingDefinition,
- const DataLayout &dataLayout) {
- return DeletionKind::Delete;
+namespace {
+template <class MemsetLike>
+void createMemsetLenAttr(MemsetLike op, IntegerAttr &memsetLenAttr) {
+ bool successfulMatch =
+ matchPattern(op.getLen(), m_Constant<IntegerAttr>(&memsetLenAttr));
+ (void)successfulMatch;
+ assert(successfulMatch);
}
-
-LogicalResult LLVM::MemsetOp::ensureOnlySafeAccesses(
- const MemorySlot &slot, SmallVectorImpl<MemorySlot> &mustBeSafelyUsed,
- const DataLayout &dataLayout) {
- return success(definitelyWritesOnlyWithinSlot(*this, slot, dataLayout));
+template <>
+void createMemsetLenAttr(LLVM::MemsetInlineOp op, IntegerAttr &memsetLenAttr) {
+ memsetLenAttr = op.getLenAttr();
+}
+template <class MemsetLike>
----------------
gysit wrote:
```suggestion
template <class MemsetLike>
```
Pleas also add a small comment.
https://github.com/llvm/llvm-project/pull/115711
More information about the Mlir-commits
mailing list