mirror of https://github.com/llvm/circt.git
[ImportVerilog] Fix use after free (#7368)
This commit is contained in:
parent
53a7802608
commit
31145f72bb
|
@ -116,10 +116,9 @@ struct RvalueExprVisitor {
|
|||
if (auto refOp = lhs.getDefiningOp<moore::StructExtractRefOp>()) {
|
||||
auto input = refOp.getInput();
|
||||
if (isa<moore::SVModuleOp>(input.getDefiningOp()->getParentOp())) {
|
||||
refOp.getInputMutable();
|
||||
refOp->erase();
|
||||
builder.create<moore::StructInjectOp>(loc, input.getType(), input,
|
||||
refOp.getFieldNameAttr(), rhs);
|
||||
refOp->erase();
|
||||
return rhs;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -424,10 +424,9 @@ struct ModuleVisitor : public BaseVisitor {
|
|||
if (auto refOp = lhs.getDefiningOp<moore::StructExtractRefOp>()) {
|
||||
auto input = refOp.getInput();
|
||||
if (isa<moore::SVModuleOp>(input.getDefiningOp()->getParentOp())) {
|
||||
refOp.getInputMutable();
|
||||
refOp->erase();
|
||||
builder.create<moore::StructInjectOp>(loc, input.getType(), input,
|
||||
refOp.getFieldNameAttr(), rhs);
|
||||
refOp->erase();
|
||||
return success();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue