mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 03:56:16 +08:00
[mlir] Support getSuccessorInputs from parent op
Ops that implement `RegionBranchOpInterface` are allowed to indicate that they can branch back to themselves in `getSuccessorRegions`, but there is no API that allows them to specify the forwarded operands. This patch enables that by changing `getSuccessorEntryOperands` to accept `None`. Fixes #54928 Reviewed By: rriddle Differential Revision: https://reviews.llvm.org/D127239
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "mlir/IR/BuiltinTypes.h"
|
||||
#include "mlir/Interfaces/ControlFlowInterfaces.h"
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
|
||||
@@ -151,16 +152,7 @@ LogicalResult detail::verifyTypesAlongControlFlowEdges(Operation *op) {
|
||||
auto regionInterface = cast<RegionBranchOpInterface>(op);
|
||||
|
||||
auto inputTypesFromParent = [&](Optional<unsigned> regionNo) -> TypeRange {
|
||||
if (regionNo.hasValue()) {
|
||||
return regionInterface.getSuccessorEntryOperands(regionNo.getValue())
|
||||
.getTypes();
|
||||
}
|
||||
|
||||
// If the successor of a parent op is the parent itself
|
||||
// RegionBranchOpInterface does not have an API to query what the entry
|
||||
// operands will be in that case. Vend out the result types of the op in
|
||||
// that case so that type checking succeeds for this case.
|
||||
return op->getResultTypes();
|
||||
return regionInterface.getSuccessorEntryOperands(regionNo).getTypes();
|
||||
};
|
||||
|
||||
// Verify types along control flow edges originating from the parent.
|
||||
|
||||
Reference in New Issue
Block a user