llvm / llvm/circt

[FIRRTL][EliminateWires] rwprobe op is not dominated by target

Open
#10,751 0 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

## Reproducer

### FIRRTL

```firrtl
FIRRTL version 7.0.0

circuit Test:
public module Test:
output rw : RWProbe>
output rw2 : RWProbe>
wire p : UInt<1>
wire w : UInt<1>
invalidate w
define rw = rwprobe(w)
define rw2 = rwprobe(p)
connect p, w
```

-->

```
eliminate-wires-rwprobe-bug.fir:11:18: error: 'firrtl.ref.rwprobe' op is not dominated by target
define rw2 = rwprobe(p)
^
eliminate-wires-rwprobe-bug.fir:11:18: note: see current operation: %3 = "firrtl.ref.rwprobe"() <{target = #hw.innerNameRef<@Test::@sym_0>}> : () -> !firrtl.rwprobe>
eliminate-wires-rwprobe-bug.fir:7:5: note: target here
wire p : UInt<1>
^
```

### MLIR

``` mlir
firrtl.circuit "Test" {
firrtl.module @Test(out %rw: !firrtl.rwprobe>, out %rw2: !firrtl.rwprobe>) attributes {convention = #firrtl} {
%c0_ui1 = firrtl.constant 0 : !firrtl.uint<1>
%p = firrtl.wire sym @sym_0 : !firrtl.uint<1>
%w = firrtl.wire sym @sym : !firrtl.uint<1>
firrtl.matchingconnect %w, %c0_ui1 : !firrtl.uint<1>
%0 = firrtl.ref.rwprobe <@Test::@sym> : !firrtl.rwprobe>
firrtl.ref.define %rw, %0 : !firrtl.rwprobe>
%1 = firrtl.ref.rwprobe <@Test::@sym_0> : !firrtl.rwprobe>
firrtl.ref.define %rw2, %1 : !firrtl.rwprobe>
firrtl.matchingconnect %p, %w : !firrtl.uint<1>
}
}
```

--> (`circt-opt --firrtl-eliminate-wires --no-implicit-module`)

```
eliminate.mlir:9:10: error: 'firrtl.ref.rwprobe' op is not dominated by target
%1 = firrtl.ref.rwprobe <@Test::@sym_0> : !firrtl.rwprobe>
^
eliminate.mlir:9:10: note: see current operation: %3 = "firrtl.ref.rwprobe"() <{target = #hw.innerNameRef<@Test::@sym_0>}> : () -> !firrtl.rwprobe>
eliminate.mlir:4:10: note: target here
%p = firrtl.wire sym @sym_0 : !firrtl.uint<1>
^
```

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 by running the supplied FIRRTL reproducer and the MLIR reproducer with `circt-opt --firrtl-eliminate-wires --no-implicit-module`. Trace the FIRRTL EliminateWires pass from this failure; done means the rwprobe targeting `sym_0` no longer produces the reported dominance error, with the intended transformed IR verified by the relevant existing tests.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.