diff --git a/include/circt/Dialect/Calyx/CalyxLoweringUtils.h b/include/circt/Dialect/Calyx/CalyxLoweringUtils.h index a8c0ce521568..d6e249ee4392 100644 --- a/include/circt/Dialect/Calyx/CalyxLoweringUtils.h +++ b/include/circt/Dialect/Calyx/CalyxLoweringUtils.h @@ -546,7 +546,7 @@ class PartialLoweringPattern : public RewritePatternType { // Do the actual rewrite, marking this op as updated. Because the op is // marked as updated, the pattern driver will re-enqueue the op again. - rewriter.updateRootInPlace( + rewriter.modifyOpInPlace( op, [&] { partialPatternRes = partiallyLower(op, rewriter); }); // Mark that this pattern has been applied to this op. @@ -557,7 +557,7 @@ class PartialLoweringPattern : public RewritePatternType { // Hook for subclasses to lower the op using the rewriter. // - // Note that this call is wrapped in `updateRootInPlace`, so any direct IR + // Note that this call is wrapped in `modifyOpInPlace`, so any direct IR // mutations that are legal to apply during a root update of op are allowed. // // Also note that this means the op will be re-enqueued to the greedy @@ -615,7 +615,7 @@ class FuncOpPartialLoweringPattern // Hook for subclasses to lower the op using the rewriter. // - // Note that this call is wrapped in `updateRootInPlace`, so any direct IR + // Note that this call is wrapped in `modifyOpInPlace`, so any direct IR // mutations that are legal to apply during a root update of op are allowed. // // Also note that this means the op will be re-enqueued to the greedy diff --git a/lib/Conversion/AffineToLoopSchedule/AffineToLoopSchedule.cpp b/lib/Conversion/AffineToLoopSchedule/AffineToLoopSchedule.cpp index df982d5c449d..656d6583103c 100644 --- a/lib/Conversion/AffineToLoopSchedule/AffineToLoopSchedule.cpp +++ b/lib/Conversion/AffineToLoopSchedule/AffineToLoopSchedule.cpp @@ -216,7 +216,7 @@ struct IfOpHoisting : OpConversionPattern { LogicalResult matchAndRewrite(IfOp op, OpAdaptor adaptor, ConversionPatternRewriter &rewriter) const override { - rewriter.updateRootInPlace(op, [&]() { + rewriter.modifyOpInPlace(op, [&]() { if (!op.thenBlock()->without_terminator().empty()) { rewriter.splitBlock(op.thenBlock(), --op.thenBlock()->end()); rewriter.inlineBlockBefore(&op.getThenRegion().front(), op); diff --git a/lib/Conversion/CFToHandshake/CFToHandshake.cpp b/lib/Conversion/CFToHandshake/CFToHandshake.cpp index 6a4f214352c7..adccdabfc9fe 100644 --- a/lib/Conversion/CFToHandshake/CFToHandshake.cpp +++ b/lib/Conversion/CFToHandshake/CFToHandshake.cpp @@ -82,7 +82,7 @@ class LowerOpTarget : public ConversionTarget { /// A partial lowering function may only replace a subset of the operations /// within the funcOp currently being lowered. However, the dialect conversion /// scheme requires the matched root operation to be replaced/updated, if the -/// match was successful. To facilitate this, rewriter.updateRootInPlace +/// match was successful. To facilitate this, rewriter.modifyOpInPlace /// wraps the partial update function. /// Next, the function operation is expected to go from illegal to legalized, /// after matchAndRewrite returned true. To work around this, @@ -103,7 +103,7 @@ struct PartialLowerOp : public ConversionPattern { matchAndRewrite(Operation *op, ArrayRef /*operands*/, ConversionPatternRewriter &rewriter) const override { assert(isa(op)); - rewriter.updateRootInPlace( + rewriter.modifyOpInPlace( op, [&] { loweringRes = fun(dyn_cast(op), rewriter); }); target.loweredOps[op] = true; return loweringRes; @@ -171,7 +171,7 @@ struct PartialLowerRegion : public ConversionPattern { LogicalResult matchAndRewrite(Operation *op, ArrayRef /*operands*/, ConversionPatternRewriter &rewriter) const override { - rewriter.updateRootInPlace( + rewriter.modifyOpInPlace( op, [&] { loweringRes = fun(target.region, rewriter); }); target.opLowered = true; diff --git a/lib/Conversion/HWToLLHD/HWToLLHD.cpp b/lib/Conversion/HWToLLHD/HWToLLHD.cpp index 70d5636fa3d1..a0c26ac5a7ae 100644 --- a/lib/Conversion/HWToLLHD/HWToLLHD.cpp +++ b/lib/Conversion/HWToLLHD/HWToLLHD.cpp @@ -72,7 +72,7 @@ struct ConvertHWModule : public OpConversionPattern { // Set the entity name attributes. Add block arguments for each output, // since LLHD entity outputs are still block arguments to the op. - rewriter.updateRootInPlace(entity, [&] { + rewriter.modifyOpInPlace(entity, [&] { entity.setName(module.getName()); entityBodyRegion.addArguments( moduleOutputs, SmallVector(moduleOutputs.size(), @@ -241,7 +241,7 @@ struct ConvertInstance : public OpConversionPattern { // a ConnectOp rather than a PrbOp+DrvOp combo. for (auto &use : llvm::make_early_inc_range(result.getUses())) { if (isa(use.getOwner())) { - rewriter.updateRootInPlace(use.getOwner(), [&]() { use.set(sig); }); + rewriter.modifyOpInPlace(use.getOwner(), [&]() { use.set(sig); }); } } diff --git a/lib/Conversion/SCFToCalyx/SCFToCalyx.cpp b/lib/Conversion/SCFToCalyx/SCFToCalyx.cpp index 315154b3f20c..e90c902c3768 100644 --- a/lib/Conversion/SCFToCalyx/SCFToCalyx.cpp +++ b/lib/Conversion/SCFToCalyx/SCFToCalyx.cpp @@ -1059,7 +1059,7 @@ struct FuncOpConversion : public calyx::FuncOpPartialLoweringPattern { funcOp.getLoc(), rewriter.getStringAttr(funcOp.getSymName()), ports); std::string funcName = "func_" + funcOp.getSymName().str(); - rewriter.updateRootInPlace(funcOp, [&]() { funcOp.setSymName(funcName); }); + rewriter.modifyOpInPlace(funcOp, [&]() { funcOp.setSymName(funcName); }); /// Mark this component as the toplevel. compOp->setAttr("toplevel", rewriter.getUnitAttr()); diff --git a/lib/Conversion/SeqToSV/SeqToSV.cpp b/lib/Conversion/SeqToSV/SeqToSV.cpp index e4ce7a5b90f1..2f6735a9e37f 100644 --- a/lib/Conversion/SeqToSV/SeqToSV.cpp +++ b/lib/Conversion/SeqToSV/SeqToSV.cpp @@ -264,7 +264,7 @@ class ClockCastLowering : public OpConversionPattern { if (Operation *inputOp = adaptor.getInput().getDefiningOp()) if (!isa(inputOp)) if (auto name = chooseName(op, inputOp)) - rewriter.updateRootInPlace( + rewriter.modifyOpInPlace( inputOp, [&] { inputOp->setAttr("sv.namehint", name); }); rewriter.replaceOp(op, adaptor.getInput()); diff --git a/lib/Dialect/Arc/Transforms/ArcCanonicalizer.cpp b/lib/Dialect/Arc/Transforms/ArcCanonicalizer.cpp index 0134504028ac..7c34a74e4b5f 100644 --- a/lib/Dialect/Arc/Transforms/ArcCanonicalizer.cpp +++ b/lib/Dialect/Arc/Transforms/ArcCanonicalizer.cpp @@ -296,7 +296,7 @@ LogicalResult MemWritePortEnableAndMaskCanonicalizer::matchAndRewrite( if (arcMapping.count(defOp.getNameAttr())) { auto arcWithoutEnable = arcMapping[defOp.getNameAttr()]; // Remove the enable attribute - rewriter.updateRootInPlace(op, [&]() { + rewriter.modifyOpInPlace(op, [&]() { op.setEnable(false); op.setArc(arcWithoutEnable.getValue()); }); @@ -310,7 +310,7 @@ LogicalResult MemWritePortEnableAndMaskCanonicalizer::matchAndRewrite( symbolCache.removeDefinitionAndAllUsers(defOp); // Remove the enable attribute - rewriter.updateRootInPlace(op, [&]() { + rewriter.modifyOpInPlace(op, [&]() { op.setEnable(false); op.setArc(newName); }); @@ -334,9 +334,9 @@ LogicalResult MemWritePortEnableAndMaskCanonicalizer::matchAndRewrite( // Remove the enable output from the current arc auto *terminator = defOp.getBodyBlock().getTerminator(); - rewriter.updateRootInPlace( + rewriter.modifyOpInPlace( terminator, [&]() { terminator->eraseOperand(op.getEnableIdx()); }); - rewriter.updateRootInPlace(defOp, [&]() { + rewriter.modifyOpInPlace(defOp, [&]() { defOp.setName(newName); defOp.setFunctionType( rewriter.getFunctionType(defOp.getArgumentTypes(), newResultTypes)); @@ -536,7 +536,7 @@ SinkArcInputsPattern::matchAndRewrite(DefineOp op, else newInputs.push_back(value); } - rewriter.updateRootInPlace( + rewriter.modifyOpInPlace( callOp, [&]() { callOp.getArgOperandsMutable().assign(newInputs); }); for (auto value : maybeUnusedValues) if (value.use_empty()) diff --git a/lib/Dialect/Arc/Transforms/GroupResetsAndEnables.cpp b/lib/Dialect/Arc/Transforms/GroupResetsAndEnables.cpp index 693a8af32f5d..e66c834a4b56 100644 --- a/lib/Dialect/Arc/Transforms/GroupResetsAndEnables.cpp +++ b/lib/Dialect/Arc/Transforms/GroupResetsAndEnables.cpp @@ -113,7 +113,7 @@ struct EnableGroupingPattern : public OpRewritePattern { scf::IfOp ifOp = rewriter.create(writeOps[0].getLoc(), enable, false); for (auto writeOp : writeOps) { - rewriter.updateRootInPlace(writeOp, [&]() { + rewriter.modifyOpInPlace(writeOp, [&]() { writeOp->moveBefore(ifOp.thenBlock()->getTerminator()); writeOp.getConditionMutable().erase(0); }); @@ -155,8 +155,8 @@ bool groupInRegion(Block *block, Operation *clockTreeOp, continue; // For some currently unknown reason, just calling moveBefore // directly has the same output but is much slower - rewriter->updateRootInPlace(definition, - [&]() { definition->moveBefore(op); }); + rewriter->modifyOpInPlace(definition, + [&]() { definition->moveBefore(op); }); changed = true; worklist.push_back(definition); } diff --git a/lib/Dialect/Arc/Transforms/LatencyRetiming.cpp b/lib/Dialect/Arc/Transforms/LatencyRetiming.cpp index f74116301579..0d6f769cb28e 100644 --- a/lib/Dialect/Arc/Transforms/LatencyRetiming.cpp +++ b/lib/Dialect/Arc/Transforms/LatencyRetiming.cpp @@ -153,7 +153,7 @@ LatencyRetimingPattern::matchAndRewrite(ClockedOpInterface op, return; } - rewriter.updateRootInPlace(op, [&]() { + rewriter.modifyOpInPlace(op, [&]() { stateOp.setLatency(newLatency); if (!stateOp.getClock() && !isInClockDomain) stateOp.getClockMutable().assign(clock); diff --git a/lib/Dialect/Comb/CombFolds.cpp b/lib/Dialect/Comb/CombFolds.cpp index febe3074887b..4ff0cfb6ad12 100644 --- a/lib/Dialect/Comb/CombFolds.cpp +++ b/lib/Dialect/Comb/CombFolds.cpp @@ -75,8 +75,8 @@ static void replaceOpAndCopyName(PatternRewriter &rewriter, Operation *op, if (auto *newOp = newValue.getDefiningOp()) { auto name = op->getAttrOfType("sv.namehint"); if (name && !newOp->hasAttr("sv.namehint")) - rewriter.updateRootInPlace(newOp, - [&] { newOp->setAttr("sv.namehint", name); }); + rewriter.modifyOpInPlace(newOp, + [&] { newOp->setAttr("sv.namehint", name); }); } rewriter.replaceOp(op, newValue); } @@ -91,8 +91,8 @@ static OpTy replaceOpWithNewOpAndCopyName(PatternRewriter &rewriter, auto newOp = rewriter.replaceOpWithNewOp(op, std::forward(args)...); if (name && !newOp->hasAttr("sv.namehint")) - rewriter.updateRootInPlace(newOp, - [&] { newOp->setAttr("sv.namehint", name); }); + rewriter.modifyOpInPlace(newOp, + [&] { newOp->setAttr("sv.namehint", name); }); return newOp; } diff --git a/lib/Dialect/Comb/Transforms/LowerComb.cpp b/lib/Dialect/Comb/Transforms/LowerComb.cpp index 5e9fd64cf19b..85a94629769b 100644 --- a/lib/Dialect/Comb/Transforms/LowerComb.cpp +++ b/lib/Dialect/Comb/Transforms/LowerComb.cpp @@ -56,7 +56,7 @@ struct TruthTableToMuxTree : public OpConversionPattern { Value f = b.create(loc, b.getIntegerAttr(b.getI1Type(), 0)); Value tree = getMux(loc, b, t, f, table, op.getInputs()); - b.updateRootInPlace(tree.getDefiningOp(), [&]() { + b.modifyOpInPlace(tree.getDefiningOp(), [&]() { tree.getDefiningOp()->setDialectAttrs(op->getDialectAttrs()); }); b.replaceOp(op, tree); diff --git a/lib/Dialect/ESI/Passes/ESILowerPhysical.cpp b/lib/Dialect/ESI/Passes/ESILowerPhysical.cpp index fde782fd5417..e2d649215065 100644 --- a/lib/Dialect/ESI/Passes/ESILowerPhysical.cpp +++ b/lib/Dialect/ESI/Passes/ESILowerPhysical.cpp @@ -146,7 +146,7 @@ PureModuleLowering::matchAndRewrite(ESIPureModuleOp pureMod, OpAdaptor adaptor, // Re-wire the inputs and erase them. for (auto input : inputs) { BlockArgument newArg; - rewriter.updateRootInPlace(hwMod, [&]() { + rewriter.modifyOpInPlace(hwMod, [&]() { newArg = body->addArgument(input.getResult().getType(), input.getLoc()); }); rewriter.replaceAllUsesWith(input.getResult(), newArg); diff --git a/lib/Dialect/FIRRTL/FIRRTLFolds.cpp b/lib/Dialect/FIRRTL/FIRRTLFolds.cpp index 994a9f644b64..1d43280162d7 100644 --- a/lib/Dialect/FIRRTL/FIRRTLFolds.cpp +++ b/lib/Dialect/FIRRTL/FIRRTLFolds.cpp @@ -101,7 +101,7 @@ static void updateName(PatternRewriter &rewriter, Operation *op, newName = chooseName(newOpName.getValue(), name.getValue()); // Only update if needed if (!newOpName || newOpName.getValue() != newName) - rewriter.updateRootInPlace( + rewriter.modifyOpInPlace( op, [&] { op->setAttr("name", rewriter.getStringAttr(newName)); }); } @@ -1374,7 +1374,7 @@ class MuxSharedCond : public mlir::RewritePattern { mlir::PatternRewriter &rewriter, bool updateInPlace) const { if (updateInPlace) { - rewriter.updateRootInPlace(mux, [&] { + rewriter.modifyOpInPlace(mux, [&] { mux.setOperand(1, high); mux.setOperand(2, low); }); @@ -1441,12 +1441,12 @@ class MuxSharedCond : public mlir::RewritePattern { return failure(); if (Value v = tryCondTrue(mux.getHigh(), mux.getSel(), rewriter, true, 0)) { - rewriter.updateRootInPlace(mux, [&] { mux.setOperand(1, v); }); + rewriter.modifyOpInPlace(mux, [&] { mux.setOperand(1, v); }); return success(); } if (Value v = tryCondFalse(mux.getLow(), mux.getSel(), rewriter, true, 0)) { - rewriter.updateRootInPlace(mux, [&] { mux.setOperand(2, v); }); + rewriter.modifyOpInPlace(mux, [&] { mux.setOperand(2, v); }); return success(); } @@ -1921,9 +1921,9 @@ struct NodeBypass : public mlir::RewritePattern { if (node.getInnerSym() || !AnnotationSet(node).canBeDeleted() || node.use_empty() || node.isForceable()) return failure(); - rewriter.startRootUpdate(node); + rewriter.startOpModification(node); node.getResult().replaceAllUsesWith(node.getInput()); - rewriter.finalizeRootUpdate(node); + rewriter.finalizeOpModification(node); return success(); } }; @@ -3198,8 +3198,8 @@ LogicalResult ClockGateIntrinsicOp::canonicalize(ClockGateIntrinsicOp op, if (auto testEnable = op.getTestEnable()) { if (auto constOp = testEnable.getDefiningOp()) { if (constOp.getValue().isZero()) { - rewriter.updateRootInPlace(op, - [&] { op.getTestEnableMutable().clear(); }); + rewriter.modifyOpInPlace(op, + [&] { op.getTestEnableMutable().clear(); }); return success(); } } diff --git a/lib/Dialect/FIRRTL/Transforms/LowerClasses.cpp b/lib/Dialect/FIRRTL/Transforms/LowerClasses.cpp index a4ad30bdc495..c0f3febf9db9 100644 --- a/lib/Dialect/FIRRTL/Transforms/LowerClasses.cpp +++ b/lib/Dialect/FIRRTL/Transforms/LowerClasses.cpp @@ -1158,7 +1158,7 @@ struct ClassOpSignatureConversion : public OpConversionPattern { &result))) return failure(); - rewriter.updateRootInPlace(classOp, []() {}); + rewriter.modifyOpInPlace(classOp, []() {}); return success(); } @@ -1184,7 +1184,7 @@ struct ClassExternOpSignatureConversion &result))) return failure(); - rewriter.updateRootInPlace(classOp, []() {}); + rewriter.modifyOpInPlace(classOp, []() {}); return success(); } diff --git a/lib/Dialect/HW/ConversionPatterns.cpp b/lib/Dialect/HW/ConversionPatterns.cpp index b642362a97de..12f513447652 100644 --- a/lib/Dialect/HW/ConversionPatterns.cpp +++ b/lib/Dialect/HW/ConversionPatterns.cpp @@ -73,7 +73,7 @@ LogicalResult circt::doTypeConversion(Operation *op, ValueRange operands, Operation *newOp = rewriter.create(state); // Move the regions over, converting the signatures as we go. - rewriter.startRootUpdate(newOp); + rewriter.startOpModification(newOp); for (size_t i = 0, e = op->getNumRegions(); i < e; ++i) { Region ®ion = op->getRegion(i); Region *newRegion = &newOp->getRegion(i); @@ -87,7 +87,7 @@ LogicalResult circt::doTypeConversion(Operation *op, ValueRange operands, "type conversion failed"); rewriter.applySignatureConversion(newRegion, result, typeConverter); } - rewriter.finalizeRootUpdate(newOp); + rewriter.finalizeOpModification(newOp); rewriter.replaceOp(op, newOp->getResults()); return success(); diff --git a/lib/Dialect/HW/HWModuleOpInterface.cpp b/lib/Dialect/HW/HWModuleOpInterface.cpp index 8628ad0a556a..42730e680940 100644 --- a/lib/Dialect/HW/HWModuleOpInterface.cpp +++ b/lib/Dialect/HW/HWModuleOpInterface.cpp @@ -59,7 +59,7 @@ static LogicalResult convertModuleOpTypes(HWModuleLike modOp, return failure(); auto newType = ModuleType::get(rewriter.getContext(), newPorts); - rewriter.updateRootInPlace(modOp, [&] { modOp.setHWModuleType(newType); }); + rewriter.modifyOpInPlace(modOp, [&] { modOp.setHWModuleType(newType); }); return success(); } diff --git a/lib/Dialect/HW/HWOps.cpp b/lib/Dialect/HW/HWOps.cpp index bf20c08e975c..80424c6f6f30 100644 --- a/lib/Dialect/HW/HWOps.cpp +++ b/lib/Dialect/HW/HWOps.cpp @@ -383,8 +383,8 @@ LogicalResult WireOp::canonicalize(WireOp wire, PatternRewriter &rewriter) { // `sv.namehint` to the expression. if (auto *inputOp = wire.getInput().getDefiningOp()) if (auto name = chooseName(wire, inputOp)) - rewriter.updateRootInPlace( - inputOp, [&] { inputOp->setAttr("sv.namehint", name); }); + rewriter.modifyOpInPlace(inputOp, + [&] { inputOp->setAttr("sv.namehint", name); }); rewriter.replaceOp(wire, wire.getInput()); return success(); diff --git a/lib/Dialect/HW/Transforms/HWSpecialize.cpp b/lib/Dialect/HW/Transforms/HWSpecialize.cpp index 8845393cebba..c511d87197df 100644 --- a/lib/Dialect/HW/Transforms/HWSpecialize.cpp +++ b/lib/Dialect/HW/Transforms/HWSpecialize.cpp @@ -167,7 +167,7 @@ struct ParametricTypeConversionPattern : public ConversionPattern { llvm::SmallVector convertedOperands; // Update the result types of the operation bool ok = true; - rewriter.updateRootInPlace(op, [&]() { + rewriter.modifyOpInPlace(op, [&]() { // Mutate result types for (auto it : llvm::enumerate(op->getResultTypes())) { FailureOr res = diff --git a/lib/Dialect/Handshake/HandshakeOps.cpp b/lib/Dialect/Handshake/HandshakeOps.cpp index bcb31f8733a1..f65280f7b685 100644 --- a/lib/Dialect/Handshake/HandshakeOps.cpp +++ b/lib/Dialect/Handshake/HandshakeOps.cpp @@ -207,7 +207,7 @@ struct EliminateUnusedForkResultsPattern : mlir::OpRewritePattern { auto operand = op.getOperand(); auto newFork = rewriter.create( op.getLoc(), operand, op.getNumResults() - unusedIndexes.size()); - rewriter.updateRootInPlace(op, [&] { + rewriter.modifyOpInPlace(op, [&] { unsigned i = 0; for (auto oldRes : llvm::enumerate(op.getResults())) if (unusedIndexes.count(oldRes.index()) == 0) @@ -232,7 +232,7 @@ struct EliminateForkToForkPattern : mlir::OpRewritePattern { /// on if op is the single user of the value), but we'll let /// EliminateUnusedForkResultsPattern apply in that case. unsigned totalNumOuts = op.getSize() + parentForkOp.getSize(); - rewriter.updateRootInPlace(parentForkOp, [&] { + rewriter.modifyOpInPlace(parentForkOp, [&] { /// Create a new parent fork op which produces all of the fork outputs and /// replace all of the uses of the old results. auto newParentForkOp = rewriter.create( @@ -364,7 +364,7 @@ struct EliminateCBranchIntoMuxPattern : OpRewritePattern { if (!secondParentCBranch || firstParentCBranch != secondParentCBranch) return failure(); - rewriter.updateRootInPlace(firstParentCBranch, [&] { + rewriter.modifyOpInPlace(firstParentCBranch, [&] { // Replace uses of the mux's output with cbranch's data input rewriter.replaceOp(op, firstParentCBranch.getDataOperand()); }); @@ -738,7 +738,7 @@ LogicalResult EliminateSimpleControlMergesPattern::matchAndRewrite( for (auto &use : llvm::make_early_inc_range(dataResult.getUses())) { auto *user = use.getOwner(); - rewriter.updateRootInPlace( + rewriter.modifyOpInPlace( user, [&]() { user->setOperand(use.getOperandNumber(), merge); }); } diff --git a/lib/Dialect/Ibis/Transforms/IbisCallPrep.cpp b/lib/Dialect/Ibis/Transforms/IbisCallPrep.cpp index 03c798c18a9b..dd236798ff04 100644 --- a/lib/Dialect/Ibis/Transforms/IbisCallPrep.cpp +++ b/lib/Dialect/Ibis/Transforms/IbisCallPrep.cpp @@ -166,7 +166,7 @@ void MergeCallArgs::rewrite(CallOp call, OpAdaptor adaptor, method.getMethodName().getValue())); // Update the call to use just the new struct. - rewriter.updateRootInPlace(call, [&]() { + rewriter.modifyOpInPlace(call, [&]() { call.getOperandsMutable().clear(); call.getOperandsMutable().append(newArg.getResult()); }); diff --git a/lib/Dialect/SV/SVOps.cpp b/lib/Dialect/SV/SVOps.cpp index d60f1d6a1129..a0a9c66fd2c1 100644 --- a/lib/Dialect/SV/SVOps.cpp +++ b/lib/Dialect/SV/SVOps.cpp @@ -1018,14 +1018,14 @@ LogicalResult CaseOp::canonicalize(CaseOp op, PatternRewriter &rewriter) { if (op.getCaseStyle() == CaseStmtType::CaseXStmt) { if (noXZ) { - rewriter.updateRootInPlace(op, [&]() { + rewriter.modifyOpInPlace(op, [&]() { op.setCaseStyleAttr( CaseStmtTypeAttr::get(op.getContext(), CaseStmtType::CaseStmt)); }); return success(); } if (noX) { - rewriter.updateRootInPlace(op, [&]() { + rewriter.modifyOpInPlace(op, [&]() { op.setCaseStyleAttr( CaseStmtTypeAttr::get(op.getContext(), CaseStmtType::CaseZStmt)); }); @@ -1034,7 +1034,7 @@ LogicalResult CaseOp::canonicalize(CaseOp op, PatternRewriter &rewriter) { } if (op.getCaseStyle() == CaseStmtType::CaseZStmt && noZ) { - rewriter.updateRootInPlace(op, [&]() { + rewriter.modifyOpInPlace(op, [&]() { op.setCaseStyleAttr( CaseStmtTypeAttr::get(op.getContext(), CaseStmtType::CaseStmt)); }); @@ -1632,7 +1632,7 @@ LogicalResult WireOp::canonicalize(WireOp wire, PatternRewriter &rewriter) { // If the wire has a name attribute, propagate the name to the expression. if (auto *connectedOp = connected.getDefiningOp()) if (!wire.getName().empty()) - rewriter.updateRootInPlace(connectedOp, [&] { + rewriter.modifyOpInPlace(connectedOp, [&] { connectedOp->setAttr("sv.namehint", wire.getNameAttr()); }); diff --git a/lib/Dialect/Seq/SeqOps.cpp b/lib/Dialect/Seq/SeqOps.cpp index b224c2256505..57869ed0888f 100644 --- a/lib/Dialect/Seq/SeqOps.cpp +++ b/lib/Dialect/Seq/SeqOps.cpp @@ -707,8 +707,8 @@ LogicalResult ClockGateOp::canonicalize(ClockGateOp op, if (auto testEnable = op.getTestEnable()) { if (auto constOp = testEnable.getDefiningOp()) { if (constOp.getValue().isZero()) { - rewriter.updateRootInPlace(op, - [&] { op.getTestEnableMutable().clear(); }); + rewriter.modifyOpInPlace(op, + [&] { op.getTestEnableMutable().clear(); }); return success(); } } @@ -788,7 +788,7 @@ LogicalResult FirMemReadOp::canonicalize(FirMemReadOp op, PatternRewriter &rewriter) { // Remove the enable if it is constant true. if (isConstAllOnes(op.getEnable())) { - rewriter.updateRootInPlace(op, [&] { op.getEnableMutable().erase(0); }); + rewriter.modifyOpInPlace(op, [&] { op.getEnableMutable().erase(0); }); return success(); } return failure(); @@ -806,13 +806,13 @@ LogicalResult FirMemWriteOp::canonicalize(FirMemWriteOp op, // Remove the enable if it is constant true. if (auto enable = op.getEnable(); isConstAllOnes(enable)) { - rewriter.updateRootInPlace(op, [&] { op.getEnableMutable().erase(0); }); + rewriter.modifyOpInPlace(op, [&] { op.getEnableMutable().erase(0); }); anyChanges = true; } // Remove the mask if it is all ones. if (auto mask = op.getMask(); isConstAllOnes(mask)) { - rewriter.updateRootInPlace(op, [&] { op.getMaskMutable().erase(0); }); + rewriter.modifyOpInPlace(op, [&] { op.getMaskMutable().erase(0); }); anyChanges = true; } @@ -838,13 +838,13 @@ LogicalResult FirMemReadWriteOp::canonicalize(FirMemReadWriteOp op, // Remove the enable if it is constant true. if (auto enable = op.getEnable(); isConstAllOnes(enable)) { - rewriter.updateRootInPlace(op, [&] { op.getEnableMutable().erase(0); }); + rewriter.modifyOpInPlace(op, [&] { op.getEnableMutable().erase(0); }); anyChanges = true; } // Remove the mask if it is all ones. if (auto mask = op.getMask(); isConstAllOnes(mask)) { - rewriter.updateRootInPlace(op, [&] { op.getMaskMutable().erase(0); }); + rewriter.modifyOpInPlace(op, [&] { op.getMaskMutable().erase(0); }); anyChanges = true; } diff --git a/lib/Transforms/InsertMergeBlocks.cpp b/lib/Transforms/InsertMergeBlocks.cpp index 0d7770a9c722..802c3837b3ab 100644 --- a/lib/Transforms/InsertMergeBlocks.cpp +++ b/lib/Transforms/InsertMergeBlocks.cpp @@ -325,13 +325,13 @@ struct FuncOpPattern : public OpConversionPattern { LogicalResult matchAndRewrite(func::FuncOp op, OpAdaptor adaptor, ConversionPatternRewriter &rewriter) const override { - rewriter.startRootUpdate(op); + rewriter.startOpModification(op); if (!op.isExternal()) if (failed(insertMergeBlocks(op.getRegion(), rewriter))) return failure(); - rewriter.finalizeRootUpdate(op); + rewriter.finalizeOpModification(op); rewrittenFuncs.insert(op); return success(); diff --git a/lib/Transforms/MaximizeSSA.cpp b/lib/Transforms/MaximizeSSA.cpp index b1a17c653600..ca7fbd18aff2 100644 --- a/lib/Transforms/MaximizeSSA.cpp +++ b/lib/Transforms/MaximizeSSA.cpp @@ -203,7 +203,7 @@ struct MaxSSAConversion : public ConversionPattern { matchAndRewrite(Operation *op, ArrayRef operands, ConversionPatternRewriter &rewriter) const override { LogicalResult conversionStatus = success(); - rewriter.updateRootInPlace(op, [&] { + rewriter.modifyOpInPlace(op, [&] { for (auto ®ion : op->getRegions()) { SSAMaximizationStrategy strategy; if (failed(maximizeSSA(region, strategy, rewriter))) diff --git a/llvm b/llvm index 00b6d032a221..103fa3250c46 160000 --- a/llvm +++ b/llvm @@ -1 +1 @@ -Subproject commit 00b6d032a22196bc14e4e30e413c040eb1b65da4 +Subproject commit 103fa3250c46b0c4cf04573c5e075185ca574016 diff --git a/test/Dialect/LoopSchedule/errors.mlir b/test/Dialect/LoopSchedule/errors.mlir index 88b2aa78b5b3..ea0ece448670 100644 --- a/test/Dialect/LoopSchedule/errors.mlir +++ b/test/Dialect/LoopSchedule/errors.mlir @@ -1,4 +1,4 @@ -// RUN: circt-opt %s -split-input-file -verify-diagnostics +// RUN: circt-opt %s -split-input-file -verify-diagnostics -allow-unregistered-dialect func.func @combinational_condition() { %c0_i32 = arith.constant 0 : i32 @@ -67,11 +67,11 @@ func.func @only_stages() { func.func @only_stages() { %false = arith.constant 0 : i1 - // expected-error @+1 {{'loopschedule.pipeline' op stages may only contain 'loopschedule.pipeline.stage' or 'loopschedule.terminator' ops, found %1 = "arith.addi"(%arg0, %arg0) : (i1, i1) -> i1}} + // expected-error @+1 {{'loopschedule.pipeline' op stages may only contain 'loopschedule.pipeline.stage' or 'loopschedule.terminator' ops, found "foo"() : () -> ()}} loopschedule.pipeline II = 1 iter_args(%arg0 = %false) : (i1) -> () { loopschedule.register %arg0 : i1 } do { - %0 = arith.addi %arg0, %arg0 : i1 + "foo"() : () -> () loopschedule.terminator iter_args(), results() : () -> () } return