[FIRRTL] Replace remove-unused-ports with port-only IMDCE mode#10575
Conversation
df39e83 to
85c55f9
Compare
| @@ -10,11 +10,11 @@ firrtl.circuit "Foo" { | |||
| // CHECK-NOT: %bar_e | |||
| // CHECK: %bar_b, %bar_d = firrtl.instance bar @Bar | |||
| %bar_a, %bar_b, %bar_c, %bar_d, %bar_e = firrtl.instance bar @Bar (in a: !firrtl.uint<1>, in b: !firrtl.uint<1>, out c: !firrtl.uint<1>, out d: !firrtl.uint<1>, out e: !firrtl.uint<1>) | |||
| firrtl.connect %bar_a, %x : !firrtl.uint<1>, !firrtl.uint<1> | |||
There was a problem hiding this comment.
connect was replaced with matching connect since IMDCE doesn't handle normal connect for the simplicity (IMDCE relies on getSingleConnectUserOf. OTOH RemoveUnusedPorts manually inspected use-def connection). I don't expect this restriction reduces capability of reducer.
seldridge
left a comment
There was a problem hiding this comment.
Awesome. Thank you for picking this up! I'm happy to see RemoveUnusedPorts getting dropped.
There was a problem hiding this comment.
Consider a file rename or moving this out of the reduction and into the main test/Dialect/FIRRTL/imdce-* suite of tests.
There was a problem hiding this comment.
I consider this as a test for --include firrtl-imdeadcodeelim-remove-ports so I'd like to keep under reduction. Fair point for file name.
| @@ -33,8 +33,8 @@ firrtl.circuit "Foo" { | |||
| ) { | |||
| %invalid_ui1 = firrtl.invalidvalue : !firrtl.uint<1> | |||
| %0 = firrtl.not %b : (!firrtl.uint<1>) -> !firrtl.uint<1> | |||
| firrtl.connect %c, %invalid_ui1 : !firrtl.uint<1>, !firrtl.uint<1> | |||
| firrtl.connect %d, %0 : !firrtl.uint<1>, !firrtl.uint<1> | |||
| firrtl.connect %e, %invalid_ui1 : !firrtl.uint<1>, !firrtl.uint<1> | |||
| firrtl.matchingconnect %c, %invalid_ui1 : !firrtl.uint<1> | |||
| firrtl.matchingconnect %d, %0 : !firrtl.uint<1> | |||
| firrtl.matchingconnect %e, %invalid_ui1 : !firrtl.uint<1> | |||
There was a problem hiding this comment.
Same question about connect vs. matchingconnect.
7466173 to
f95cda8
Compare
f95cda8 to
4988f5a
Compare
Co-authored-by: Schuyler Eldridge <schuyler.eldridge@gmail.com>
This PR replaces RemoveUnusedPorts with IMDCE by adding a new mode to IMDCE as mentioned in #10501.
To mimic the old RemoveUnusedPorts behavior, this PR adds two options (1) dropping donttouch (2) remove only ports. Maybe it might be better to move (1) to reduction pattern instead of implementing in IMDCE pass, though.
Invalid value propagation is added as well to pass the old test.
This PR fixes crashes in #10501 and #10504. IMDCE doesn't eliminate property/instance choices at this point though.
Close #3377.
Assisted-by: claude code: sonnet 4.6