[mlir] Add initial graphdef->mlir generation
This CL adds:
* One graphdef extracted from the TF test suite. More will come.
* Scaffolding for the "graphdef2mlir" tool.
* Importing of simple graphs. Type inference is not yet working, and attributes do not work either.
* A fix for CFGFunction::~CFGFunction to not die if the function was destroyed without a terminator (for example if we exit early due to an error).
PiperOrigin-RevId: 206965992
diff --git a/lib/IR/Function.cpp b/lib/IR/Function.cpp
index 60beeca..96c6dfc 100644
--- a/lib/IR/Function.cpp
+++ b/lib/IR/Function.cpp
@@ -109,7 +109,8 @@
for (auto &bb : *this) {
for (auto &inst : bb)
inst.dropAllReferences();
- bb.getTerminator()->dropAllReferences();
+ if (bb.getTerminator())
+ bb.getTerminator()->dropAllReferences();
}
}