15 #include "llvm/ADT/DenseSet.h"
21 #define GEN_PASS_DEF_INFEREFFECTSPASS
22 #include "mlir/Dialect/Transform/Transforms/Passes.h.inc"
27 if (!isa<transform::TransformOpInterface>(op))
30 auto func = dyn_cast<FunctionOpInterface>(op);
31 if (!func || func.isExternal())
34 if (!func.getFunctionBody().hasOneBlock()) {
36 <<
"only single-block operations are currently supported";
41 llvm::SmallDenseSet<unsigned> consumedArguments;
45 for (
unsigned i = 0, e = func.getNumArguments(); i < e; ++i) {
47 consumedArguments.contains(i)
48 ? transform::TransformDialect::kArgConsumedAttrName
49 : transform::TransformDialect::kArgReadOnlyAttrName,
56 class InferEffectsPass
57 :
public transform::impl::InferEffectsPassBase<InferEffectsPass> {
59 void runOnOperation()
override {
65 return signalPassFailure();
static LogicalResult inferSideEffectAnnotations(Operation *op)
Operation is the basic unit of execution within MLIR.
MLIRContext * getContext()
Return the context this operation is associated with.
InFlightDiagnostic emitError(const Twine &message={})
Emit an error about fatal conditions with this operation, reporting up to any diagnostic handlers tha...
A utility result that is used to signal how to proceed with an ongoing walk:
bool wasInterrupted() const
Returns true if the walk was interrupted.
static WalkResult interrupt()
Include the generated interface declarations.
auto get(MLIRContext *context, Ts &&...params)
Helper method that injects context only if needed, this helps unify some of the attribute constructio...