Add assert in Operation->printAssembly to check improperly created Op's.

We allow the name of an operation to be different from the name of the
'ConcreteType' op it was instantiated with. This can happen when you sub-class
an existing op and provide a getOperationName for it. Such a situation leads to
an assertion too deep and at a place seeminly unrelated, and typically when the
module is printed with the trace:

printOperation, printAssembly, Op::print, getOperand, dyn_cast<OperationStmt>,
isa. 'isa' will complain about being called on a null pointer, and the null
pointer actually comes from the getAs<> in printAssembly. This should have been
caught in printAssembly.

On another note, it is also weird that we allow setting the op's name to
something independent of the ConcreteType that op was instantiated with - so,
getAs<ConcreteType> will fail since ConcreteType::isClassFor won't succeed on
it.

PiperOrigin-RevId: 216580294
1 file changed
tree: 3d79a4461ccc72f6c7529459f1c8329f7c91bc0d
  1. include/
  2. lib/
  3. test/
  4. tools/
  5. utils/
  6. .clang-format
  7. LICENSE.TXT