This gives you the parent block of the operation, e.g., the block that contains it. What you need is the entry block of the function body region, which is you can get as func.front() provided the function is non-empty.
when use this solution to analyse the extenral callable object like “func.func private @printmemref32()”
In face, i found the “front” function in mlir::Region class, which i don’t know why it can be used for func::FuncOp, so it’s recommended to use func::FuncOp’s getCallableRegion() to get callable region, apply if (region != nullptr) ,and then {region.front()} to get the entryblock