Region with single empty block

Hey everyone,

I have a question related to the parsing of regions with empty blocks.
I can parse the region { ^bb: }, which produce correctly a region with a single empty block.
However, when printing it with printRegion, I get {} instead, which when parsed again result in an empty region (with no blocks).

Is this a bug, or is there a fundamental problem with region with single empty blocks?


Would you mind trying your code with the pass -mlir-print-op-generic?

I think the printer with syntax sugar is responsible for omitting your basic block.

Indeed, this seems to be a problem with the syntax sugar.
When printing it with -mlir-print-op-generic, I indeed get ({ ^bb0: }) for the region.

printRegion takes a flag that indicates whether to print the header for the empty entry block, which defaults to false - llvm-project/AsmPrinter.cpp at 988a3ba0d815110fe4df03cab1077ddef7b23252 · llvm/llvm-project · GitHub

Oh thanks, I completely missed that ^^’