Skip to content

Commit 612aea1

Browse files
committed
[rebase] take upstream version of AffinePromotion.cpp
1 parent 62ef725 commit 612aea1

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

flang/lib/Optimizer/Transforms/AffinePromotion.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
8+
//
9+
// This transformation is a prototype that promote FIR loops operations
10+
// to affine dialect operations.
11+
// It is not part of the production pipeline and would need more work in order
12+
// to be used in production.
13+
// More information can be found in this presentation:
14+
// https://slides.com/rajanwalia/deck
15+
//
16+
//===----------------------------------------------------------------------===//
817

918
#include "PassDetail.h"
1019
#include "flang/Optimizer/Dialect/FIRDialect.h"
@@ -31,8 +40,8 @@ struct AffineLoopAnalysis;
3140
struct AffineIfAnalysis;
3241

3342
/// Stores analysis objects for all loops and if operations inside a function
34-
/// these analysis are used twice, first for marking operations for rewrite and
35-
/// second when doing rewrite.
43+
/// these analysis are used twice, first for marking operations for rewrite and
44+
/// second when doing rewrite.
3645
struct AffineFunctionAnalysis {
3746
explicit AffineFunctionAnalysis(mlir::FuncOp funcOp) {
3847
for (fir::DoLoopOp op : funcOp.getOps<fir::DoLoopOp>())
@@ -315,7 +324,7 @@ static mlir::AffineMap createArrayIndexAffineMap(unsigned dimensions,
315324
}
316325

317326
static Optional<int64_t> constantIntegerLike(const mlir::Value value) {
318-
if (auto definition = value.getDefiningOp<ConstantOp>())
327+
if (auto definition = value.getDefiningOp<mlir::arith::ConstantOp>())
319328
if (auto stepAttr = definition.value().dyn_cast<IntegerAttr>())
320329
return stepAttr.getInt();
321330
return {};

0 commit comments

Comments
 (0)