diff options
author | Markus Böck <markus.bock+llvm@nextsilicon.com> | 2023-08-09 16:11:52 +0200 |
---|---|---|
committer | Markus Böck <markus.bock+llvm@nextsilicon.com> | 2023-08-10 10:27:27 +0200 |
commit | 138df298208a095dc9bb9e5d1e3c67231b0abd77 (patch) | |
tree | bfb995e0e7a6bef20c8238e9d31ea158206eeccc /libcxx/src/algorithm.cpp | |
parent | f5ccac713f0c5d4ef25999ca5b3b228fe8fe54f9 (diff) | |
download | llvm-138df298208a095dc9bb9e5d1e3c67231b0abd77.zip llvm-138df298208a095dc9bb9e5d1e3c67231b0abd77.tar.gz llvm-138df298208a095dc9bb9e5d1e3c67231b0abd77.tar.bz2 |
[mlir] Revamp `RegionBranchOpInterface` successor mechanism
The `RegionBranchOpInterface` had a few fundamental issues caused by the API design of `getSuccessorRegions`.
It always required passing values for the `operands` parameter. This is problematic as the operands parameter actually changes meaning depending on which predecessor `index` is referring to. If coming from a region, you'd have to find a `RegionBranchTerminatorOpInterface` in that region, get its operand count, and then create a `SmallVector` of that size.
This is not only inconvenient, but also error-prone, which has lead to a bug in the implementation of a previously existing `getSuccessorRegions` overload.
Additionally, this made the method dual-use, trying to serve two different use-cases: 1) Trying to determine possible control flow edges between regions and 2) Trying to determine the region being branched to based on constant operands.
This patch fixes these issues by changing the interface methods and adding new ones:
* The `operands` argument of `getSuccessorRegions` has been removed. The method is now only responsible for returning possible control flow edges between regions.
* An optional `getEntrySuccessorRegions` method has been added. This is used to determine which regions are branched to from the parent op based on constant operands of the parent op. By default, it calls `getSuccessorRegions`. This is analogous to `getSuccessorForOperands` from `BranchOpInterface`.
* Add `getSuccessorRegions` to `RegionBranchTerminatorOpInterface`. This is used to get the possible successors of the terminator based on constant operands. By default, it calls the containing `RegionBranchOpInterface`s `getSuccessorRegions` method.
* `getSuccessorEntryOperands` was renamed to `getEntrySuccessorOperands` for consistency.
Differential Revision: https://reviews.llvm.org/D157506
Diffstat (limited to 'libcxx/src/algorithm.cpp')
0 files changed, 0 insertions, 0 deletions