[Mlir-commits] [mlir] 765ac6e - [mlir] Remove ReferTo attr constraint

Jacques Pienaar llvmlistbot at llvm.org
Sat Oct 1 17:19:24 PDT 2022


Author: Jacques Pienaar
Date: 2022-10-01T17:19:14-07:00
New Revision: 765ac6e9dfe10ce5e38305080af49d05b99b1784

URL: https://github.com/llvm/llvm-project/commit/765ac6e9dfe10ce5e38305080af49d05b99b1784
DIFF: https://github.com/llvm/llvm-project/commit/765ac6e9dfe10ce5e38305080af49d05b99b1784.diff

LOG: [mlir] Remove ReferTo attr constraint

The current generation is unsafe as it is evaluated during verify
invocation rather than during verifySymbolUses. Remove until this is
safely generated.

Differential Revision: https://reviews.llvm.org/D134558

Added: 
    

Modified: 
    mlir/include/mlir/IR/OpBase.td
    mlir/test/IR/attribute.mlir
    mlir/test/lib/Dialect/Test/TestOps.td

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/IR/OpBase.td b/mlir/include/mlir/IR/OpBase.td
index 25068bb66af6a..213340f47424b 100644
--- a/mlir/include/mlir/IR/OpBase.td
+++ b/mlir/include/mlir/IR/OpBase.td
@@ -1655,16 +1655,6 @@ class IntArrayNthElemMinValue<int index, int min> : AttrConstraint<
 def IsNullAttr : AttrConstraint<
     CPred<"!$_self">, "empty attribute (for optional attributes)">;
 
-// An attribute constraint on FlatSymbolRefAttr that requires that the
-// reference point to an op of `opClass` within the closest parent with a symbol
-// table.
-// TODO: Add support for nested symbol references.
-class ReferToOp<string opClass> : AttrConstraint<
-    CPred<"isa_and_nonnull<" # opClass # ">("
-            "::mlir::SymbolTable::lookupNearestSymbolFrom("
-              "&$_op, $_self.cast<::mlir::FlatSymbolRefAttr>().getAttr()))">,
-    "referencing to a '" # opClass # "' symbol">;
-
 //===----------------------------------------------------------------------===//
 // Region definitions
 //===----------------------------------------------------------------------===//

diff  --git a/mlir/test/IR/attribute.mlir b/mlir/test/IR/attribute.mlir
index 7870606adab78..f27e53e334978 100644
--- a/mlir/test/IR/attribute.mlir
+++ b/mlir/test/IR/attribute.mlir
@@ -608,11 +608,6 @@ func.func @fn() { return }
 
 // -----
 
-// expected-error @+1 {{referencing to a 'func::FuncOp' symbol}}
-"test.symbol_ref_attr"() {symbol = @foo} : () -> ()
-
-// -----
-
 //===----------------------------------------------------------------------===//
 // Test IntElementsAttr
 //===----------------------------------------------------------------------===//

diff  --git a/mlir/test/lib/Dialect/Test/TestOps.td b/mlir/test/lib/Dialect/Test/TestOps.td
index d10c2c97709c1..0a9c6beb39786 100644
--- a/mlir/test/lib/Dialect/Test/TestOps.td
+++ b/mlir/test/lib/Dialect/Test/TestOps.td
@@ -378,16 +378,6 @@ def OpWithBitEnumVerticalBar : TEST_Op<"op_with_bit_enum_vbar"> {
   let assemblyFormat = "$value (`tag` $tag^)? attr-dict";
 }
 
-//===----------------------------------------------------------------------===//
-// Test Attribute Constraints
-//===----------------------------------------------------------------------===//
-
-def SymbolRefOp : TEST_Op<"symbol_ref_attr"> {
-  let arguments = (ins
-    ConfinedAttr<FlatSymbolRefAttr, [ReferToOp<"func::FuncOp">]>:$symbol
-  );
-}
-
 //===----------------------------------------------------------------------===//
 // Test Regions
 //===----------------------------------------------------------------------===//


        


More information about the Mlir-commits mailing list