Skip to content

Commit

Permalink
[IMDCE] Remove dead hierpath and annotations in IMDCE (#5226)
Browse files Browse the repository at this point in the history
This PR adds functionality to find and remove dead hierpaths and weak referencing annotations in IMDCE.
Even though it's not explicitly defined yet, some annotations (for example OMIRTracker)
are expected to be removed when annotation targets are dead. In many cases OMIRTracker
is represented as non-local annotations associated with hierpaths which are users of inner symbols.
So this PR imports some of InnerSymbolDCE  logic into IMDCE and aggressively removes inner symbols.
  • Loading branch information
uenoku committed Jun 7, 2023
1 parent 96fcaa0 commit d299e9d
Show file tree
Hide file tree
Showing 7 changed files with 355 additions and 84 deletions.
2 changes: 1 addition & 1 deletion include/circt/Dialect/FIRRTL/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def RemoveUnusedPorts : Pass<"firrtl-remove-unused-ports", "firrtl::CircuitOp">
];
}

def IMDeadCodeElim : Pass<"firrtl-imdeadcodeelim", "firrtl::CircuitOp"> {
def IMDeadCodeElim : Pass<"firrtl-imdeadcodeelim", "mlir::ModuleOp"> {
let summary = "Intermodule dead code elimination";
let description = [{
This pass performs inter-module liveness analysis and deletes dead code
Expand Down
1 change: 1 addition & 0 deletions lib/Dialect/FIRRTL/Transforms/EmitOMIR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ static std::optional<Attribute> scatterOMIR(Attribute original,
tracker.append("class", StringAttr::get(ctx, omirTrackerAnnoClass));
tracker.append("id", idAttr);
tracker.append("target", StringAttr::get(ctx, value));
tracker.append("type", StringAttr::get(ctx, tpe));

state.addToWorklistFn(DictionaryAttr::get(ctx, tracker));

Expand Down
Loading

0 comments on commit d299e9d

Please sign in to comment.