[Mlir-commits] [mlir] c38b1fa - [mlir] Fix loop-like interface (#95817)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Jun 19 01:03:45 PDT 2024


Author: Ivan Kulagin
Date: 2024-06-19T09:03:42+01:00
New Revision: c38b1fa32599cd84f60d09a0efdac62faa9c416e

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

LOG: [mlir] Fix loop-like interface (#95817)

Using the `this` pointer inside interface methods is illegal because it
breaks concept-based interfaces.
 It is necessary to use `$_op` instead.

Co-authored-by: ikulagin <i.kulagin at ispras.ru>

Added: 
    

Modified: 
    mlir/include/mlir/Interfaces/LoopLikeInterface.td

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Interfaces/LoopLikeInterface.td b/mlir/include/mlir/Interfaces/LoopLikeInterface.td
index b748d5e29114a..7db624ba43974 100644
--- a/mlir/include/mlir/Interfaces/LoopLikeInterface.td
+++ b/mlir/include/mlir/Interfaces/LoopLikeInterface.td
@@ -246,7 +246,7 @@ def LoopLikeOpInterface : OpInterface<"LoopLikeOpInterface"> {
     /// If there is a single induction variable return it, otherwise return
     /// std::nullopt.
     ::std::optional<::mlir::Value> getSingleInductionVar() {
-      auto inductionVars = this->getLoopInductionVars();
+      auto inductionVars = $_op.getLoopInductionVars();
       if (inductionVars.has_value() && (*inductionVars).size() == 1)
           return (*inductionVars)[0];
         return std::nullopt;
@@ -254,7 +254,7 @@ def LoopLikeOpInterface : OpInterface<"LoopLikeOpInterface"> {
     /// Return the single lower bound value or attribute if it exists, otherwise
     /// return std::nullopt.
     ::std::optional<::mlir::OpFoldResult> getSingleLowerBound() {
-      auto lowerBounds = this->getLoopLowerBounds();
+      auto lowerBounds = $_op.getLoopLowerBounds();
       if (lowerBounds.has_value() && (*lowerBounds).size() == 1)
           return (*lowerBounds)[0];
       return std::nullopt;
@@ -262,7 +262,7 @@ def LoopLikeOpInterface : OpInterface<"LoopLikeOpInterface"> {
     /// Return the single step value or attribute if it exists, otherwise
     /// return std::nullopt.
     ::std::optional<::mlir::OpFoldResult> getSingleStep() {
-      auto steps = this->getLoopSteps(); 
+      auto steps = $_op.getLoopSteps();
       if (steps.has_value() && (*steps).size() == 1)
           return (*steps)[0];
       return std::nullopt;
@@ -270,7 +270,7 @@ def LoopLikeOpInterface : OpInterface<"LoopLikeOpInterface"> {
     /// Return the single upper bound value or attribute if it exists, otherwise
     /// return std::nullopt.
     ::std::optional<::mlir::OpFoldResult> getSingleUpperBound() {
-      auto upperBounds = this->getLoopUpperBounds();
+      auto upperBounds = $_op.getLoopUpperBounds();
       if (upperBounds.has_value() && (*upperBounds).size() == 1)
           return (*upperBounds)[0];
       return std::nullopt;


        


More information about the Mlir-commits mailing list