[Mlir-commits] [mlir] 2fa2248 - [mlir] Placeholder used in predicate should be the base type

Chia-hung Duan llvmlistbot at llvm.org
Tue Oct 26 10:37:25 PDT 2021


Author: Chia-hung Duan
Date: 2021-10-26T17:36:46Z
New Revision: 2fa22488d5d11e2b3f7cefc3bd19f73c27fc6dac

URL: https://github.com/llvm/llvm-project/commit/2fa22488d5d11e2b3f7cefc3bd19f73c27fc6dac
DIFF: https://github.com/llvm/llvm-project/commit/2fa22488d5d11e2b3f7cefc3bd19f73c27fc6dac.diff

LOG: [mlir] Placeholder used in predicate should be the base type

Added a notification in the placeholder section. While writing things
like preciate of an attribute, we may embed certain placeholder in the C
expression. Note that the type of the placeholder is only guaranteed to
be the base type like mlir::Type, it's better not to use the derived
type which is based on the implementation.

Reviewed By: mehdi_amini

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

Added: 
    

Modified: 
    mlir/include/mlir/IR/OpBase.td

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/IR/OpBase.td b/mlir/include/mlir/IR/OpBase.td
index f30693dc76720..978f95c01436e 100644
--- a/mlir/include/mlir/IR/OpBase.td
+++ b/mlir/include/mlir/IR/OpBase.td
@@ -77,6 +77,11 @@ class Pred;
 //   type constraints directly to an operand/result, $_self will be replaced
 //   by the operand/result's type. E.g., for `F32` in `F32:$operand`, its
 //   `$_self` will be expanded as `getOperand(...).getType()`.
+//
+// One thing to be noticed, while using these placeholders in the C expression,
+// the type of placeholder is only guaranteed to be the base type. For example,
+// if you have a predicate in the form `CPred<"CheckType($_self)">, the argument
+// type of the function `CheckType` should be `mlir::Type`.
 class CPred<code pred> : Pred {
   code predExpr = "(" # pred # ")";
 }


        


More information about the Mlir-commits mailing list