[Mlir-commits] [mlir] [MLIR] Preserve operand segment sizes when removing dead inputs (PR #223154)
Mehdi Amini
llvmlistbot at llvm.org
Mon Sep 21 03:45:39 PDT 2026
================
@@ -244,6 +244,37 @@ void RewriterBase::eraseBlock(Block *block) {
block->erase();
}
+void RewriterBase::eraseOperands(Operation *op, const BitVector &eraseIndices) {
+ assert(eraseIndices.size() == op->getNumOperands() &&
+ "expected one bit per operand");
+ if (eraseIndices.none())
+ return;
+
+ modifyOpInPlace(op, [&]() {
+ op->eraseOperands(eraseIndices);
+ if (!op->hasTrait<OpTrait::AttrSizedOperandSegments>())
+ return;
+
+ // TODO: Add an interface to update the operand segment-size property
+ // directly, without converting it to and from an attribute.
+ auto attrName = StringAttr::get(
----------------
joker-eph wrote:
Seems like instead of a trait, this should be an interface so that we don't even use a string-based mechanism to touch those "Internal" data structures. They are not even stored as attributes.
https://github.com/llvm/llvm-project/pull/223154
More information about the Mlir-commits
mailing list