Skip to content

Commit eefc60b

Browse files
committed
Drop clone methods
1 parent e8b70bf commit eefc60b

File tree

2 files changed

+0
-84
lines changed

2 files changed

+0
-84
lines changed

mlir/include/mlir/Dialect/EmitC/IR/EmitC.td

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -513,22 +513,6 @@ def EmitC_FuncOp : EmitC_Op<"func", [
513513
CArg<"ArrayRef<DictionaryAttr>", "{}">:$argAttrs)
514514
>];
515515
let extraClassDeclaration = [{
516-
/// Create a deep copy of this function and all of its blocks, remapping any
517-
/// operands that use values outside of the function using the map that is
518-
/// provided (leaving them alone if no entry is present). If the mapper
519-
/// contains entries for function arguments, these arguments are not
520-
/// included in the new function. Replaces references to cloned sub-values
521-
/// with the corresponding value that is copied, and adds those mappings to
522-
/// the mapper.
523-
FuncOp clone(IRMapping &mapper);
524-
FuncOp clone();
525-
526-
/// Clone the internal blocks and attributes from this function into dest.
527-
/// Any cloned blocks are appended to the back of dest. This function
528-
/// asserts that the attributes of the current function and dest are
529-
/// compatible.
530-
void cloneInto(FuncOp dest, IRMapping &mapper);
531-
532516
//===------------------------------------------------------------------===//
533517
// FunctionOpInterface Methods
534518
//===------------------------------------------------------------------===//

mlir/lib/Dialect/EmitC/IR/EmitC.cpp

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -431,74 +431,6 @@ void FuncOp::print(OpAsmPrinter &p) {
431431
getArgAttrsAttrName(), getResAttrsAttrName());
432432
}
433433

434-
/// Clone the internal blocks from this function into dest and all attributes
435-
/// from this function to dest.
436-
void FuncOp::cloneInto(FuncOp dest, IRMapping &mapper) {
437-
// Add the attributes of this function to dest.
438-
llvm::MapVector<StringAttr, Attribute> newAttrMap;
439-
for (const auto &attr : dest->getAttrs())
440-
newAttrMap.insert({attr.getName(), attr.getValue()});
441-
for (const auto &attr : (*this)->getAttrs())
442-
newAttrMap.insert({attr.getName(), attr.getValue()});
443-
444-
auto newAttrs = llvm::to_vector(llvm::map_range(
445-
newAttrMap, [](std::pair<StringAttr, Attribute> attrPair) {
446-
return NamedAttribute(attrPair.first, attrPair.second);
447-
}));
448-
dest->setAttrs(DictionaryAttr::get(getContext(), newAttrs));
449-
450-
// Clone the body.
451-
getBody().cloneInto(&dest.getBody(), mapper);
452-
}
453-
454-
/// Create a deep copy of this function and all of its blocks, remapping
455-
/// any operands that use values outside of the function using the map that is
456-
/// provided (leaving them alone if no entry is present). Replaces references
457-
/// to cloned sub-values with the corresponding value that is copied, and adds
458-
/// those mappings to the mapper.
459-
FuncOp FuncOp::clone(IRMapping &mapper) {
460-
// Create the new function.
461-
FuncOp newFunc = cast<FuncOp>(getOperation()->cloneWithoutRegions());
462-
463-
// If the function has a body, then the user might be deleting arguments to
464-
// the function by specifying them in the mapper. If so, we don't add the
465-
// argument to the input type vector.
466-
if (!isExternal()) {
467-
FunctionType oldType = getFunctionType();
468-
469-
unsigned oldNumArgs = oldType.getNumInputs();
470-
SmallVector<Type, 4> newInputs;
471-
newInputs.reserve(oldNumArgs);
472-
for (unsigned i = 0; i != oldNumArgs; ++i)
473-
if (!mapper.contains(getArgument(i)))
474-
newInputs.push_back(oldType.getInput(i));
475-
476-
/// If any of the arguments were dropped, update the type and drop any
477-
/// necessary argument attributes.
478-
if (newInputs.size() != oldNumArgs) {
479-
newFunc.setType(FunctionType::get(oldType.getContext(), newInputs,
480-
oldType.getResults()));
481-
482-
if (ArrayAttr argAttrs = getAllArgAttrs()) {
483-
SmallVector<Attribute> newArgAttrs;
484-
newArgAttrs.reserve(newInputs.size());
485-
for (unsigned i = 0; i != oldNumArgs; ++i)
486-
if (!mapper.contains(getArgument(i)))
487-
newArgAttrs.push_back(argAttrs[i]);
488-
newFunc.setAllArgAttrs(newArgAttrs);
489-
}
490-
}
491-
}
492-
493-
/// Clone the current function into the new one and return it.
494-
cloneInto(newFunc, mapper);
495-
return newFunc;
496-
}
497-
FuncOp FuncOp::clone() {
498-
IRMapping mapper;
499-
return clone(mapper);
500-
}
501-
502434
LogicalResult FuncOp::verify() {
503435
if (getNumResults() > 1)
504436
return emitOpError("requires zero or exactly one result, but has ")

0 commit comments

Comments
 (0)