Skip to content

Commit

Permalink
[FIRRTL][LowerLayers] Remove handling of some ref ops (#7640)
Browse files Browse the repository at this point in the history
Remove code that handles the capturing of ref cast and ref send operands specially, since
this code is doing only what the generic capture-handling code does just a few lines below.

There is a bug in the handling of ref.cast which is removed by this change: We
are accidentally checking that the cast op itself is within the layerblock,
when we should actually be checking if its operand is defined within the
layerblock. This causes us to incorrectly capture the operand of a ref.cast op.
The generic codepath works fine.
  • Loading branch information
rwy7 authored Sep 30, 2024
1 parent 6a724e5 commit 6e4e866
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions lib/Dialect/FIRRTL/Transforms/LowerLayers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -539,22 +539,6 @@ LogicalResult LowerLayersPass::runOnModuleBody(FModuleOp moduleOp,
return WalkResult::interrupt();
}

// Beyond this point, we are handling operations which capture values
// defined outside the layerblock. Whenever we see this, we need to
// create ports for the module that this layerblock will become.
if (auto refSend = dyn_cast<RefSendOp>(op)) {
auto src = refSend.getBase();
if (!isAncestorOfValueOwner(layerBlock, src))
createInputPort(src, op.getLoc());
continue;
}

if (auto refCast = dyn_cast<RefCastOp>(op)) {
if (!isAncestorOfValueOwner(layerBlock, refCast))
createInputPort(refCast.getInput(), op.getLoc());
continue;
}

if (auto rwprobe = dyn_cast<RWProbeOp>(op)) {
rwprobes.push_back(rwprobe);
continue;
Expand Down

0 comments on commit 6e4e866

Please sign in to comment.