16 #include "llvm/ADT/DenseSet.h"
22 #define GEN_PASS_DEF_INFEREFFECTSPASS
23 #include "mlir/Dialect/Transform/Transforms/Passes.h.inc"
28 if (!isa<transform::TransformOpInterface>(op))
31 auto func = dyn_cast<FunctionOpInterface>(op);
32 if (!func || func.isExternal())
35 if (!func.getFunctionBody().hasOneBlock()) {
37 <<
"only single-block operations are currently supported";
42 llvm::SmallDenseSet<unsigned> consumedArguments;
46 for (
unsigned i = 0, e = func.getNumArguments(); i < e; ++i) {
48 consumedArguments.contains(i)
49 ? transform::TransformDialect::kArgConsumedAttrName
50 : transform::TransformDialect::kArgReadOnlyAttrName,
57 class InferEffectsPass
58 :
public transform::impl::InferEffectsPassBase<InferEffectsPass> {
60 void runOnOperation()
override {
66 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...