[llvm-branch-commits] [mlir] Backport into 17.x : [mlir][nfc] Allow ops to have operands/attributes named `context`. (PR #65281)

Mehdi Amini via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Sep 4 11:51:19 PDT 2023


https://github.com/joker-eph created https://github.com/llvm/llvm-project/pull/65281:

This is important to back port because it'll help adopting MLIR "properties" which became the default in LLVM 18

Reviewed By: mehdi_amini

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

>From 1810c14ff5f3a0a34b8a4c858f51f15264236eba Mon Sep 17 00:00:00 2001
From: Christian Sigg <csigg at google.com>
Date: Wed, 30 Aug 2023 12:23:25 +0200
Subject: [PATCH] [mlir][nfc] Allow ops to have operands/attributes named
 `context`.

This is probably a bad idea, but it's only become a problem with properties and is easy to fix.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D159185
---
 mlir/include/mlir/IR/OperationSupport.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mlir/include/mlir/IR/OperationSupport.h b/mlir/include/mlir/IR/OperationSupport.h
index f3a79eb52f8ec00..adae3560570ddca 100644
--- a/mlir/include/mlir/IR/OperationSupport.h
+++ b/mlir/include/mlir/IR/OperationSupport.h
@@ -555,7 +555,7 @@ class RegisteredOperationName : public OperationName {
                                              StringRef name) final {
       if constexpr (hasProperties) {
         auto concreteOp = cast<ConcreteOp>(op);
-        return ConcreteOp::getInherentAttr(concreteOp.getContext(),
+        return ConcreteOp::getInherentAttr(concreteOp->getContext(),
                                            concreteOp.getProperties(), name);
       }
       // If the op does not have support for properties, we dispatch back to the
@@ -576,7 +576,7 @@ class RegisteredOperationName : public OperationName {
     void populateInherentAttrs(Operation *op, NamedAttrList &attrs) final {
       if constexpr (hasProperties) {
         auto concreteOp = cast<ConcreteOp>(op);
-        ConcreteOp::populateInherentAttrs(concreteOp.getContext(),
+        ConcreteOp::populateInherentAttrs(concreteOp->getContext(),
                                           concreteOp.getProperties(), attrs);
       }
     }



More information about the llvm-branch-commits mailing list