Remove dangling constant op (#205)

This commit is contained in:
Tung D. Le 2020-07-07 14:47:54 +09:00 committed by GitHub
parent 7e05f371de
commit 8b6cf7c661
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 6 deletions

View File

@ -222,8 +222,12 @@ private:
// Trailing optional inputs. // Trailing optional inputs.
if (!variadicIn) if (!variadicIn)
for (auto i = inputs.size(); i < expectedNumOperands; i++) for (auto i = inputs.size(); i < expectedNumOperands; i++) {
if (!none_)
none_ = builder_.create<mlir::ConstantOp>(
UnknownLoc(), builder_.getUnitAttr());
inputs.emplace_back(none_); inputs.emplace_back(none_);
}
std::vector<mlir::Type> outputTypes; std::vector<mlir::Type> outputTypes;
@ -482,11 +486,6 @@ private:
} }
} }
// Create a NoneTyped constant to be used for optional operation inputs
// which are not used.
none_ =
builder_.create<mlir::ConstantOp>(UnknownLoc(), builder_.getUnitAttr());
// Import nodes in the graph. // Import nodes in the graph.
for (const auto &item : graph.node()) { for (const auto &item : graph.node()) {
ImportNode(item); ImportNode(item);