5
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
6
//
7
7
// ===----------------------------------------------------------------------===//
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
+ // ===----------------------------------------------------------------------===//
8
17
9
18
#include " PassDetail.h"
10
19
#include " flang/Optimizer/Dialect/FIRDialect.h"
@@ -31,8 +40,8 @@ struct AffineLoopAnalysis;
31
40
struct AffineIfAnalysis ;
32
41
33
42
// / 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.
36
45
struct AffineFunctionAnalysis {
37
46
explicit AffineFunctionAnalysis (mlir::FuncOp funcOp) {
38
47
for (fir::DoLoopOp op : funcOp.getOps <fir::DoLoopOp>())
@@ -315,7 +324,7 @@ static mlir::AffineMap createArrayIndexAffineMap(unsigned dimensions,
315
324
}
316
325
317
326
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>())
319
328
if (auto stepAttr = definition.value ().dyn_cast <IntegerAttr>())
320
329
return stepAttr.getInt ();
321
330
return {};
0 commit comments