llvm / llvm/circt

[FIRRTL][IMDCE] Annotations on ports are not preserved when moving to wires

Open
#6,059 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug FIRRTL
Dominant language
C++
Stars
2.2k
Forks
524
Avg merge
3d 2h
Merged PRs (30d)
46

Description

Input:

// -----
// Test that annotations keep ports alive.
// CHECK-LABEL: "AnnoAlivePort"
firrtl.circuit "AnnoAlivePort" {
  // CHECK: module private @AnnoPort
  firrtl.module private @AnnoPort(out %dead : !firrtl.uint<5> [{class = "circt.test"}]) {}
  firrtl.module @AnnoAlivePort() {
    // CHECK: firrtl.instance
    %inst_dead = firrtl.instance inst @AnnoPort(out dead : !firrtl.uint<5>)
  }
}

The port is dead at instantiation sites but alive within the module, so port is dropped and wire is created for it (maybe it's written/read locally, so on).

Looks like annotations are not moved to the wire, however, here's the current output pointing IMDCE at the above:

firrtl.circuit "AnnoAlivePort" {
  firrtl.module private @AnnoPort() {
    %0 = firrtl.wire : !firrtl.uint<5>
  }
  firrtl.module @AnnoAlivePort() {
    firrtl.instance inst @AnnoPort()
  }
}

cc #6046 for more discussion on annotations and IMDCE, but not directly related.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the IMDCE pass and reproduce the issue using the provided MLIR input, focusing on the port-to-wire transformation. Done means the port annotation is preserved on the generated wire and the resulting IR matches the intended checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.