[mlir][Interfaces][NFC] Document that `RegionBranchTerminatorOpInterface` is mandatory (#174978)
Document that implementing the `RegionBranchTerminatorOpInterface` is
mandatory. Omitting this interface on a block terminator that models
region branching may lead to invalid/incomplete analyses and
transformations.
This commit does not change the op/interface semantics. It just puts in
writing an assumption that is made throughout the code base. For
example:
- It is baked into the API design of the `RegionBranchOpInterface`. You
cannot query the region successors of block terminators that do not
implement the `RegionBranchTerminatorOpInterface`:
`RegionBranchOpInterface::getSuccessors()` takes a `RegionBranchPoint`
parameter, and such region branch points can be constructed only from
`RegionBranchTerminatorOpInterface` and not arbitrary `Operation *`.
- Helper functions + default interface method implementations enumerate
region branch points by looking for `RegionBranchTerminatorOpInterface`
and ignoring other operations. E.g.,
`RegionBranchOpInterface::getAllRegionBranchPoints`, default
implementation of `RegionBranchOpInterface::getSuccessorRegions(Region
&)`, default implementation of
`RegionBranchOpInterface::getPredecessorValues`.
- Core analyses such as `DeadCodeAnalysis` look for
`RegionBranchTerminatorOpInterface` and misbehave when the interface is
not implemented. The analysis does not (and cannot) query region
successors of a region branching terminator that does not implement the
`RegionBranchTerminatorOpInterface`. In practice, this means that
forgetting to implement the `RegionBranchTerminatorOpInterface` may
incorrectly classify regions as dead.
- Other analyses / transformations that look for and depend on the
implementation of `RegionBranchTerminatorOpInterface`:
`mlir::getControlFlowPredecessors`,
`AbstractDenseBackwardDataFlowAnalysis`, ownership-based buffer
deallocation pass.