1//===-- Passes.td - Transform dialect pass definitions -----*- tablegen -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef MLIR_DIALECT_TRANSFORM_TRANSFORMS_PASSES
10#define MLIR_DIALECT_TRANSFORM_TRANSFORMS_PASSES
11
12include "mlir/Pass/PassBase.td"
13
14def CheckUses : Pass<"transform-dialect-check-uses"> {
15  let summary = "warn about potential use-after-free in the transform dialect";
16  let description = [{
17    This pass analyzes operations from the transform dialect and its extensions
18    and warns if a transform IR value may be used by an operation after it was
19    "freed" by some other operation, as described by side effects on the
20    `TransformMappingResource`. This statically detects situations that lead to
21    errors when interpreting the Transform IR.
22
23    The pass is capable of handling branching control flow and reports all
24    _potential_ use-after-free situations, e.g., a may-use-after-free is
25    reported if at least one of the control flow paths between the definition of
26    a value and its use contains an operation with a "free" effect on the
27    `TransformMappingResource`. It does not currently perform an SCCP-style data
28    flow analysis to prove that some branches are not taken, however, SCCP and
29    other control flow simplifications can be performed on the transform IR
30    prior to this pass provided that transform ops implement the relevant
31    control flow interfaces.
32  }];
33  let constructor = "::mlir::transform::createCheckUsesPass()";
34}
35
36#endif // MLIR_DIALECT_TRANSFORM_TRANSFORMS_PASSES
37