Skip to content

Commit

Permalink
Bump LLVM to 560b72c0408a8f7e4340a1d4197b164a14cd30b0. (#8043)
Browse files Browse the repository at this point in the history
This is a standard LLVM bump, with some minor tweaks to take into
account the last DialectConversion migrations.

Co-authored-by: Morten Borup Petersen <mpetersen@microsoft.com>
Co-authored-by: Martin Erhart <maerhart@outlook.com>
  • Loading branch information
3 people authored Jan 9, 2025
1 parent af7d6c2 commit 98ba184
Show file tree
Hide file tree
Showing 15 changed files with 44 additions and 29 deletions.
9 changes: 4 additions & 5 deletions lib/Conversion/LoopScheduleToCalyx/LoopScheduleToCalyx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1510,11 +1510,10 @@ class LoopScheduleToCalyxPass
if (runOnce)
config.maxIterations = 1;

/// Can't return applyPatternsAndFoldGreedily. Root isn't
/// Can't return applyPatternsGreedily. Root isn't
/// necessarily erased so it will always return failed(). Instead,
/// forward the 'succeeded' value from PartialLoweringPatternBase.
(void)applyPatternsAndFoldGreedily(getOperation(), std::move(pattern),
config);
(void)applyPatternsGreedily(getOperation(), std::move(pattern), config);
return partialPatternRes;
}

Expand Down Expand Up @@ -1642,8 +1641,8 @@ void LoopScheduleToCalyxPass::runOnOperation() {
RewritePatternSet cleanupPatterns(&getContext());
cleanupPatterns.add<calyx::MultipleGroupDonePattern,
calyx::NonTerminatingGroupDonePattern>(&getContext());
if (failed(applyPatternsAndFoldGreedily(getOperation(),
std::move(cleanupPatterns)))) {
if (failed(
applyPatternsGreedily(getOperation(), std::move(cleanupPatterns)))) {
signalPassFailure();
return;
}
Expand Down
9 changes: 4 additions & 5 deletions lib/Conversion/SCFToCalyx/SCFToCalyx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2491,11 +2491,10 @@ class SCFToCalyxPass : public circt::impl::SCFToCalyxBase<SCFToCalyxPass> {
if (runOnce)
config.maxIterations = 1;

/// Can't return applyPatternsAndFoldGreedily. Root isn't
/// Can't return applyPatternsGreedily. Root isn't
/// necessarily erased so it will always return failed(). Instead,
/// forward the 'succeeded' value from PartialLoweringPatternBase.
(void)applyPatternsAndFoldGreedily(getOperation(), std::move(pattern),
config);
(void)applyPatternsGreedily(getOperation(), std::move(pattern), config);
return partialPatternRes;
}

Expand Down Expand Up @@ -2818,8 +2817,8 @@ void SCFToCalyxPass::runOnOperation() {
RewritePatternSet cleanupPatterns(&getContext());
cleanupPatterns.add<calyx::MultipleGroupDonePattern,
calyx::NonTerminatingGroupDonePattern>(&getContext());
if (failed(applyPatternsAndFoldGreedily(getOperation(),
std::move(cleanupPatterns)))) {
if (failed(
applyPatternsGreedily(getOperation(), std::move(cleanupPatterns)))) {
signalPassFailure();
return;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Dialect/AIG/Transforms/LowerVariadic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@ void LowerVariadicPass::runOnOperation() {
populateLowerVariadicPatterns(patterns);
mlir::FrozenRewritePatternSet frozen(std::move(patterns));

if (failed(mlir::applyPatternsAndFoldGreedily(getOperation(), frozen)))
if (failed(mlir::applyPatternsGreedily(getOperation(), frozen)))
return signalPassFailure();
}
4 changes: 2 additions & 2 deletions lib/Dialect/AIG/Transforms/LowerWordToBits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void LowerWordToBitsPass::runOnOperation() {
// Use top-down traversal to reuse bits from `comb.concat`.
config.useTopDownTraversal = true;

if (failed(mlir::applyPatternsAndFoldGreedily(getOperation(), frozenPatterns,
config)))
if (failed(
mlir::applyPatternsGreedily(getOperation(), frozenPatterns, config)))
return signalPassFailure();
}
8 changes: 4 additions & 4 deletions lib/Dialect/Arc/Transforms/ArcCanonicalizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -802,8 +802,8 @@ void ArcCanonicalizerPass::runOnOperation() {
symbolPatterns.add<MemWritePortEnableAndMaskCanonicalizer>(
&getContext(), cache, names, statistics, arcMapping);

if (failed(mlir::applyPatternsAndFoldGreedily(
getOperation(), std::move(symbolPatterns), config)))
if (failed(mlir::applyPatternsGreedily(getOperation(),
std::move(symbolPatterns), config)))
return signalPassFailure();

numArcArgsRemoved = statistics.removeUnusedArcArgumentsPatternNumArgsRemoved;
Expand All @@ -817,8 +817,8 @@ void ArcCanonicalizerPass::runOnOperation() {
KeepOneVecOp>(&getContext());

// Don't test for convergence since it is often not reached.
(void)mlir::applyPatternsAndFoldGreedily(getOperation(), std::move(patterns),
config);
(void)mlir::applyPatternsGreedily(getOperation(), std::move(patterns),
config);
}

std::unique_ptr<mlir::Pass> arc::createArcCanonicalizerPass() {
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 @@ -198,7 +198,7 @@ void LatencyRetimingPass::runOnOperation() {
RewritePatternSet patterns(&getContext());
patterns.add<LatencyRetimingPattern>(&getContext(), cache, statistics);

if (failed(applyPatternsAndFoldGreedily(getOperation(), std::move(patterns))))
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns))))
return signalPassFailure();

numOpsRemoved = statistics.numOpsRemoved;
Expand Down
3 changes: 1 addition & 2 deletions lib/Dialect/ESI/Passes/ESILowerBundles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,7 @@ void ESIBundlesPass::runOnOperation() {
RewritePatternSet patterns(&ctxt);
PackBundleOp::getCanonicalizationPatterns(patterns, &ctxt);
UnpackBundleOp::getCanonicalizationPatterns(patterns, &ctxt);
if (failed(mlir::applyPatternsAndFoldGreedily(getOperation(),
std::move(patterns))))
if (failed(mlir::applyPatternsGreedily(getOperation(), std::move(patterns))))
signalPassFailure();

top.walk([&](PackBundleOp pack) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Dialect/FIRRTL/Transforms/Vectorization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void VectorizationPass::runOnOperation() {
VectorCreateToLogicElementwise<XorPrimOp, ElementwiseXorPrimOp>>(
&getContext());
mlir::FrozenRewritePatternSet frozenPatterns(std::move(patterns));
(void)applyPatternsAndFoldGreedily(getOperation(), frozenPatterns);
(void)applyPatternsGreedily(getOperation(), frozenPatterns);
}

std::unique_ptr<mlir::Pass> circt::firrtl::createVectorizationPass() {
Expand Down
12 changes: 12 additions & 0 deletions lib/Dialect/HW/Transforms/FlattenIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,18 @@ class FlattenIOTypeConverter : public TypeConverter {
auto result = builder.create<hw::StructCreateOp>(loc, type, inputs);
return result.getResult();
});

// In the presence of hw.extern_module which takes struct arguments, we may
// have materialized struct explodes for said arguments (say, e.g., if the
// parent module of the hw.instance had structs in its input, and feeds
// these structs to the hw.instance).
// These struct explodes needs to be converted back to the original struct,
// which persist beyond the conversion.
addSourceMaterialization([](OpBuilder &builder, hw::StructType type,
ValueRange inputs, Location loc) {
auto result = builder.create<hw::StructCreateOp>(loc, type, inputs);
return result.getResult();
});
}
};

Expand Down
3 changes: 1 addition & 2 deletions lib/Dialect/Handshake/Transforms/SplitMerges.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,7 @@ struct HandshakeSplitMerges
patterns.insert<DeconstructCMergePattern, DeconstructMergePattern>(
&getContext());

if (failed(
applyPatternsAndFoldGreedily(getOperation(), std::move(patterns))))
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns))))
signalPassFailure();
};
};
Expand Down
2 changes: 1 addition & 1 deletion lib/Dialect/Verif/Transforms/LowerFormalToHW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ void LowerFormalToHWPass::runOnOperation() {
RewritePatternSet patterns(&getContext());
patterns.add<FormalOpRewritePattern>(patterns.getContext());

if (failed(applyPatternsAndFoldGreedily(getOperation(), std::move(patterns))))
if (failed(applyPatternsGreedily(getOperation(), std::move(patterns))))
signalPassFailure();
}
4 changes: 2 additions & 2 deletions lib/Transforms/MemoryBanking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,8 @@ void MemoryBankingPass::runOnOperation() {

GreedyRewriteConfig config;
config.strictMode = GreedyRewriteStrictness::ExistingOps;
if (failed(applyPatternsAndFoldGreedily(getOperation(), std::move(patterns),
config))) {
if (failed(
applyPatternsGreedily(getOperation(), std::move(patterns), config))) {
signalPassFailure();
}

Expand Down
2 changes: 1 addition & 1 deletion llvm
Submodule llvm updated 3996 files
4 changes: 2 additions & 2 deletions test/Conversion/VerifToSMT/verif-to-smt.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ func.func @test_lec(%arg0: !smt.bv<1>) -> (i1, i1, i1) {
verif.assert %0 : i1

// CHECK: [[EQ:%.+]] = smt.solver() : () -> i1
// CHECK: [[IN0:%.+]] = smt.declare_fun : !smt.bv<32>
// CHECK: [[IN1:%.+]] = smt.declare_fun : !smt.bv<32>
// CHECK-DAG: [[IN0:%.+]] = smt.declare_fun : !smt.bv<32>
// CHECK-DAG: [[IN1:%.+]] = smt.declare_fun : !smt.bv<32>
// CHECK-DAG: [[V0:%.+]] = builtin.unrealized_conversion_cast [[IN0]] : !smt.bv<32> to i32
// CHECK-DAG: [[V1:%.+]] = builtin.unrealized_conversion_cast [[IN1]] : !smt.bv<32> to i32
// CHECK-DAG: [[V2:%.+]]:2 = "some_op"([[V0]], [[V1]]) : (i32, i32) -> (i32, i32)
Expand Down
7 changes: 7 additions & 0 deletions test/Dialect/HW/flatten-io.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ hw.module @instance_extern2(in %arg0 : i32, in %arg1 : !Struct1, out out : !Stru
hw.module.extern @level1_extern(in %arg0 : i32, in %in : !Struct1, in %arg1: i32, out out0 : i32, out out: !Struct1, out out1: i32)


// BASIC-LABEL: hw.module @instance_extern(in %arg0 : i32, in %arg1.a : i1, in %arg1.b : i2, out out.a : i1, out out.b : i2) {
// BASIC-NEXT: %0 = hw.struct_create (%arg1.a, %arg1.b) : !hw.struct<a: i1, b: i2>
// BASIC-NEXT: %l1.out0, %l1.out, %l1.out1 = hw.instance "l1" @level1_extern(arg0: %arg0: i32, in: %0: !hw.struct<a: i1, b: i2>, arg1: %arg0: i32) -> (out0: i32, out: !hw.struct<a: i1, b: i2>, out1: i32)
// BASIC-NEXT: %a, %b = hw.struct_explode %l1.out : !hw.struct<a: i1, b: i2>
// BASIC-NEXT: hw.output %a, %b : i1, i2
// BASIC-NEXT: }

// EXTERN-LABEL: hw.module @instance_extern(in %arg0 : i32, in %arg1_a : i1, in %arg1_b : i2, out out_a : i1, out out_b : i2) {
// EXTERN-NEXT: %l1.out0, %l1.out_a, %l1.out_b, %l1.out1 = hw.instance "l1" @level1_extern(arg0: %arg0: i32, in_a: %arg1_a: i1, in_b: %arg1_b: i2, arg1: %arg0: i32) -> (out0: i32, out_a: i1, out_b: i2, out1: i32)
// EXTERN-NEXT: %0 = hw.struct_create (%l1.out_a, %l1.out_b) : !hw.struct<a: i1, b: i2>
Expand Down

0 comments on commit 98ba184

Please sign in to comment.