LLVM Discussion Forums

Type output/dump (for debug)

Hi All-

I’ve been digging around the MLIR API, but I haven’t found a way to quickly output a list of mlir::Type. I don’t know how useful this would be in production, but it would be immensely useful for debugging and testing type systems. Does this functionality exist?


Not sure if I understand the request correctly, but llvm::errs() << type << "\n"; usually works.
If you have a container of Type (any range actually), then you can also likely use llvm::interleaveComma(type_range, llvm::errs());

1 Like

Well that’s embarrassing. Serves me right for not trying the simple thing first!

Thanks! Sorry for the dumb question.

As an addition, most IR classes have a dump method that is essentially llvm::errs() << *this;. It can be called from inside gdb to inspect the object.