Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump llvm submodule to tip of main (103fa3250c46) #6589

Merged
merged 6 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions include/circt/Dialect/Calyx/CalyxLoweringUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ class PartialLoweringPattern : public RewritePatternType<OpType> {

// 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.
Expand All @@ -557,7 +557,7 @@ class PartialLoweringPattern : public RewritePatternType<OpType> {

// 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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ struct IfOpHoisting : OpConversionPattern<IfOp> {
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);
Expand Down
6 changes: 3 additions & 3 deletions lib/Conversion/CFToHandshake/CFToHandshake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -103,7 +103,7 @@ struct PartialLowerOp : public ConversionPattern {
matchAndRewrite(Operation *op, ArrayRef<Value> /*operands*/,
ConversionPatternRewriter &rewriter) const override {
assert(isa<TOp>(op));
rewriter.updateRootInPlace(
rewriter.modifyOpInPlace(
op, [&] { loweringRes = fun(dyn_cast<TOp>(op), rewriter); });
target.loweredOps[op] = true;
return loweringRes;
Expand Down Expand Up @@ -171,7 +171,7 @@ struct PartialLowerRegion : public ConversionPattern {
LogicalResult
matchAndRewrite(Operation *op, ArrayRef<Value> /*operands*/,
ConversionPatternRewriter &rewriter) const override {
rewriter.updateRootInPlace(
rewriter.modifyOpInPlace(
op, [&] { loweringRes = fun(target.region, rewriter); });

target.opLowered = true;
Expand Down
4 changes: 2 additions & 2 deletions lib/Conversion/HWToLLHD/HWToLLHD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ struct ConvertHWModule : public OpConversionPattern<HWModuleOp> {

// 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<Location, 4>(moduleOutputs.size(),
Expand Down Expand Up @@ -241,7 +241,7 @@ struct ConvertInstance : public OpConversionPattern<InstanceOp> {
// a ConnectOp rather than a PrbOp+DrvOp combo.
for (auto &use : llvm::make_early_inc_range(result.getUses())) {
if (isa<hw::OutputOp>(use.getOwner())) {
rewriter.updateRootInPlace(use.getOwner(), [&]() { use.set(sig); });
rewriter.modifyOpInPlace(use.getOwner(), [&]() { use.set(sig); });
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Conversion/SCFToCalyx/SCFToCalyx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion lib/Conversion/SeqToSV/SeqToSV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ class ClockCastLowering : public OpConversionPattern<T> {
if (Operation *inputOp = adaptor.getInput().getDefiningOp())
if (!isa<mlir::UnrealizedConversionCastOp>(inputOp))
if (auto name = chooseName(op, inputOp))
rewriter.updateRootInPlace(
rewriter.modifyOpInPlace(
inputOp, [&] { inputOp->setAttr("sv.namehint", name); });

rewriter.replaceOp(op, adaptor.getInput());
Expand Down
10 changes: 5 additions & 5 deletions lib/Dialect/Arc/Transforms/ArcCanonicalizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
});
Expand All @@ -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);
});
Expand All @@ -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));
Expand Down Expand Up @@ -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())
Expand Down
6 changes: 3 additions & 3 deletions lib/Dialect/Arc/Transforms/GroupResetsAndEnables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ struct EnableGroupingPattern : public OpRewritePattern<ClockTreeOp> {
scf::IfOp ifOp =
rewriter.create<scf::IfOp>(writeOps[0].getLoc(), enable, false);
for (auto writeOp : writeOps) {
rewriter.updateRootInPlace(writeOp, [&]() {
rewriter.modifyOpInPlace(writeOp, [&]() {
writeOp->moveBefore(ifOp.thenBlock()->getTerminator());
writeOp.getConditionMutable().erase(0);
});
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Dialect/Arc/Transforms/LatencyRetiming.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions lib/Dialect/Comb/CombFolds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ static void replaceOpAndCopyName(PatternRewriter &rewriter, Operation *op,
if (auto *newOp = newValue.getDefiningOp()) {
auto name = op->getAttrOfType<StringAttr>("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);
}
Expand All @@ -91,8 +91,8 @@ static OpTy replaceOpWithNewOpAndCopyName(PatternRewriter &rewriter,
auto newOp =
rewriter.replaceOpWithNewOp<OpTy>(op, std::forward<Args>(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;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Dialect/Comb/Transforms/LowerComb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct TruthTableToMuxTree : public OpConversionPattern<TruthTableOp> {
Value f = b.create<hw::ConstantOp>(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);
Expand Down
2 changes: 1 addition & 1 deletion lib/Dialect/ESI/Passes/ESILowerPhysical.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
16 changes: 8 additions & 8 deletions lib/Dialect/FIRRTL/FIRRTLFolds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)); });
}

Expand Down Expand Up @@ -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);
});
Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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();
}
};
Expand Down Expand Up @@ -3198,8 +3198,8 @@ LogicalResult ClockGateIntrinsicOp::canonicalize(ClockGateIntrinsicOp op,
if (auto testEnable = op.getTestEnable()) {
if (auto constOp = testEnable.getDefiningOp<ConstantOp>()) {
if (constOp.getValue().isZero()) {
rewriter.updateRootInPlace(op,
[&] { op.getTestEnableMutable().clear(); });
rewriter.modifyOpInPlace(op,
[&] { op.getTestEnableMutable().clear(); });
return success();
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Dialect/FIRRTL/Transforms/LowerClasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,7 @@ struct ClassOpSignatureConversion : public OpConversionPattern<om::ClassOp> {
&result)))
return failure();

rewriter.updateRootInPlace(classOp, []() {});
rewriter.modifyOpInPlace(classOp, []() {});

return success();
}
Expand All @@ -1184,7 +1184,7 @@ struct ClassExternOpSignatureConversion
&result)))
return failure();

rewriter.updateRootInPlace(classOp, []() {});
rewriter.modifyOpInPlace(classOp, []() {});

return success();
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Dialect/HW/ConversionPatterns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 &region = op->getRegion(i);
Region *newRegion = &newOp->getRegion(i);
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion lib/Dialect/HW/HWModuleOpInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Dialect/HW/HWOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion lib/Dialect/HW/Transforms/HWSpecialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ struct ParametricTypeConversionPattern : public ConversionPattern {
llvm::SmallVector<Value, 4> 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<Type> res =
Expand Down
8 changes: 4 additions & 4 deletions lib/Dialect/Handshake/HandshakeOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ struct EliminateUnusedForkResultsPattern : mlir::OpRewritePattern<ForkOp> {
auto operand = op.getOperand();
auto newFork = rewriter.create<ForkOp>(
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)
Expand All @@ -232,7 +232,7 @@ struct EliminateForkToForkPattern : mlir::OpRewritePattern<ForkOp> {
/// 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<ForkOp>(
Expand Down Expand Up @@ -364,7 +364,7 @@ struct EliminateCBranchIntoMuxPattern : OpRewritePattern<MuxOp> {
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());
});
Expand Down Expand Up @@ -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); });
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Dialect/Ibis/Transforms/IbisCallPrep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
});
Expand Down
Loading