[flang-commits] [flang] 4283168 - Fix AffineDemotion pass after the DialectConversion change in D111620

River Riddle via flang-commits flang-commits at lists.llvm.org
Tue Oct 26 21:13:35 PDT 2021


Author: River Riddle
Date: 2021-10-27T04:13:18Z
New Revision: 42831686034bd799ef5af4914e27e66b353338b6

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

LOG: Fix AffineDemotion pass after the DialectConversion change in D111620

Added: 
    

Modified: 
    flang/lib/Optimizer/Transforms/AffineDemotion.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Optimizer/Transforms/AffineDemotion.cpp b/flang/lib/Optimizer/Transforms/AffineDemotion.cpp
index d774d974f7ab..fa28f0a13736 100644
--- a/flang/lib/Optimizer/Transforms/AffineDemotion.cpp
+++ b/flang/lib/Optimizer/Transforms/AffineDemotion.cpp
@@ -42,13 +42,14 @@ using namespace fir;
 
 namespace {
 
-class AffineLoadConversion : public OpRewritePattern<mlir::AffineLoadOp> {
+class AffineLoadConversion : public OpConversionPattern<mlir::AffineLoadOp> {
 public:
-  using OpRewritePattern<mlir::AffineLoadOp>::OpRewritePattern;
+  using OpConversionPattern<mlir::AffineLoadOp>::OpConversionPattern;
 
-  LogicalResult matchAndRewrite(mlir::AffineLoadOp op,
-                                PatternRewriter &rewriter) const override {
-    SmallVector<Value> indices(op.getMapOperands());
+  LogicalResult
+  matchAndRewrite(mlir::AffineLoadOp op, OpAdaptor adaptor,
+                  ConversionPatternRewriter &rewriter) const override {
+    SmallVector<Value> indices(adaptor.indices());
     auto maybeExpandedMap =
         expandAffineMap(rewriter, op.getLoc(), op.getAffineMap(), indices);
     if (!maybeExpandedMap)
@@ -56,20 +57,21 @@ class AffineLoadConversion : public OpRewritePattern<mlir::AffineLoadOp> {
 
     auto coorOp = rewriter.create<fir::CoordinateOp>(
         op.getLoc(), fir::ReferenceType::get(op.getResult().getType()),
-        op.getMemRef(), *maybeExpandedMap);
+        adaptor.memref(), *maybeExpandedMap);
 
     rewriter.replaceOpWithNewOp<fir::LoadOp>(op, coorOp.getResult());
     return success();
   }
 };
 
-class AffineStoreConversion : public OpRewritePattern<mlir::AffineStoreOp> {
+class AffineStoreConversion : public OpConversionPattern<mlir::AffineStoreOp> {
 public:
-  using OpRewritePattern<mlir::AffineStoreOp>::OpRewritePattern;
+  using OpConversionPattern<mlir::AffineStoreOp>::OpConversionPattern;
 
-  LogicalResult matchAndRewrite(mlir::AffineStoreOp op,
-                                PatternRewriter &rewriter) const override {
-    SmallVector<Value> indices(op.getMapOperands());
+  LogicalResult
+  matchAndRewrite(mlir::AffineStoreOp op, OpAdaptor adaptor,
+                  ConversionPatternRewriter &rewriter) const override {
+    SmallVector<Value> indices(op.indices());
     auto maybeExpandedMap =
         expandAffineMap(rewriter, op.getLoc(), op.getAffineMap(), indices);
     if (!maybeExpandedMap)
@@ -77,8 +79,8 @@ class AffineStoreConversion : public OpRewritePattern<mlir::AffineStoreOp> {
 
     auto coorOp = rewriter.create<fir::CoordinateOp>(
         op.getLoc(), fir::ReferenceType::get(op.getValueToStore().getType()),
-        op.getMemRef(), *maybeExpandedMap);
-    rewriter.replaceOpWithNewOp<fir::StoreOp>(op, op.getValueToStore(),
+        adaptor.memref(), *maybeExpandedMap);
+    rewriter.replaceOpWithNewOp<fir::StoreOp>(op, adaptor.value(),
                                               coorOp.getResult());
     return success();
   }


        


More information about the flang-commits mailing list