-
Notifications
You must be signed in to change notification settings - Fork 375
Open
Labels
bugSomething isn't workingSomething isn't working
Description
UnusedOpPruner removes block arguments but it's not generally legal, e.g. HW module requires the module type is consistent with block arguments
circt/include/circt/Support/UnusedOpPruner.h
Lines 69 to 87 in 9e689e9
while (!blockArgsToEraseIfUnused.empty()) { | |
auto it = blockArgsToEraseIfUnused.begin(); | |
auto arg = *it; | |
blockArgsToEraseIfUnused.erase(it); | |
if (!arg.use_empty()) | |
continue; | |
if (!llvm::all_of(arg.getOwner()->getUses(), [](auto &blockOperand) { | |
return isa<BranchOpInterface>(blockOperand.getOwner()); | |
})) | |
continue; | |
unsigned argIdx = arg.getArgNumber(); | |
for (auto &blockOperand : arg.getOwner()->getUses()) { | |
auto branchOp = cast<BranchOpInterface>(blockOperand.getOwner()); | |
auto operands = | |
branchOp.getSuccessorOperands(blockOperand.getOperandNumber()); | |
eraseLaterIfUnused(operands[argIdx]); | |
operands.erase(argIdx); | |
} | |
arg.getOwner()->eraseArgument(argIdx); |
fabianschuiki
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working