Skip to content

Commit

Permalink
[mlir] Remove getNumberOfExecutions from RegionBranchOpInterface
Browse files Browse the repository at this point in the history
`getNumRegionInvocations` was originally added for the async reference counting, but turned out to be not useful, and currently is not used anywhere (couldn't find any uses in public github repos). Removing dead code.

Reviewed By: Mogball, mehdi_amini

Differential Revision: https://reviews.llvm.org/D117347
  • Loading branch information
ezhulenev committed Jan 14, 2022
1 parent 7c269db commit 69bc334
Show file tree
Hide file tree
Showing 18 changed files with 1 addition and 841 deletions.
107 changes: 0 additions & 107 deletions mlir/include/mlir/Analysis/NumberOfExecutions.h

This file was deleted.

3 changes: 1 addition & 2 deletions mlir/include/mlir/Dialect/Async/IR/AsyncOps.td
Expand Up @@ -29,8 +29,7 @@ class Async_Op<string mnemonic, list<OpTrait> traits = []> :
def Async_ExecuteOp :
Async_Op<"execute", [SingleBlockImplicitTerminator<"YieldOp">,
DeclareOpInterfaceMethods<RegionBranchOpInterface,
["getSuccessorEntryOperands",
"getNumRegionInvocations"]>,
["getSuccessorEntryOperands"]>,
AttrSizedOperandSegments]> {
let summary = "Asynchronous execute operation";
let description = [{
Expand Down
11 changes: 0 additions & 11 deletions mlir/include/mlir/Dialect/SCF/SCFOps.td
Expand Up @@ -309,11 +309,6 @@ def ForOp : SCF_Op<"for",
/// induction variable. LoopOp only has one region, so 0 is the only valid
/// value for `index`.
OperandRange getSuccessorEntryOperands(unsigned index);

/// Returns the number of invocations of the body block if the loop bounds
/// are constants. Returns `kUnknownNumRegionInvocations` otherwise.
void getNumRegionInvocations(ArrayRef<Attribute> operands,
SmallVectorImpl<int64_t> &countPerRegion);
}];

let hasCanonicalizer = 1;
Expand Down Expand Up @@ -404,12 +399,6 @@ def IfOp : SCF_Op<"if",
YieldOp thenYield();
Block* elseBlock();
YieldOp elseYield();

/// If the condition is a constant, returns 1 for the executed block and 0
/// for the other. Otherwise, returns `kUnknownNumRegionInvocations` for
/// both successors.
void getNumRegionInvocations(ArrayRef<Attribute> operands,
SmallVectorImpl<int64_t> &countPerRegion);
}];
let hasFolder = 1;
let hasCanonicalizer = 1;
Expand Down
3 changes: 0 additions & 3 deletions mlir/include/mlir/Interfaces/ControlFlowInterfaces.h
Expand Up @@ -41,9 +41,6 @@ LogicalResult verifyBranchSuccessorOperands(Operation *op, unsigned succNo,
// RegionBranchOpInterface
//===----------------------------------------------------------------------===//

// A constant value to represent unknown number of region invocations.
extern const int64_t kUnknownNumRegionInvocations;

namespace detail {
/// Verify that types match along control flow edges described the given op.
LogicalResult verifyTypesAlongControlFlowEdges(Operation *op);
Expand Down
20 changes: 0 additions & 20 deletions mlir/include/mlir/Interfaces/ControlFlowInterfaces.td
Expand Up @@ -129,26 +129,6 @@ def RegionBranchOpInterface : OpInterface<"RegionBranchOpInterface"> {
"void", "getSuccessorRegions",
(ins "::mlir::Optional<unsigned>":$index, "::mlir::ArrayRef<::mlir::Attribute>":$operands,
"::mlir::SmallVectorImpl<::mlir::RegionSuccessor> &":$regions)
>,
InterfaceMethod<[{
Populates countPerRegion with the number of times this operation will
invoke the attached regions (assuming the regions yield normally, i.e.
do not abort or invoke an infinite loop). If the number of region
invocations is not known statically it will set the number of
invocations to `kUnknownNumRegionInvocations`.

`operands` is a set of optional attributes that either correspond to a
constant values for each operand of this operation, or null if that
operand is not a constant.
}],
"void", "getNumRegionInvocations",
(ins "::mlir::ArrayRef<::mlir::Attribute>":$operands,
"::mlir::SmallVectorImpl<int64_t> &":$countPerRegion), [{}],
/*defaultImplementation=*/[{
unsigned numRegions = this->getOperation()->getNumRegions();
assert(countPerRegion.empty());
countPerRegion.resize(numRegions, kUnknownNumRegionInvocations);
}]
>
];

Expand Down
2 changes: 0 additions & 2 deletions mlir/lib/Analysis/CMakeLists.txt
Expand Up @@ -9,7 +9,6 @@ set(LLVM_OPTIONAL_SOURCES
Liveness.cpp
LoopAnalysis.cpp
NestedMatcher.cpp
NumberOfExecutions.cpp
SliceAnalysis.cpp
Utils.cpp

Expand All @@ -23,7 +22,6 @@ add_mlir_library(MLIRAnalysis
DataFlowAnalysis.cpp
DataLayoutAnalysis.cpp
Liveness.cpp
NumberOfExecutions.cpp
SliceAnalysis.cpp

AliasAnalysis/LocalAliasAnalysis.cpp
Expand Down

0 comments on commit 69bc334

Please sign in to comment.