[PATCH] D114159: [flang][codegen] Add a conversion for `fir.coordinate_of` - part 1

Valentin Clement via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 18 06:42:00 PST 2021


clementval added inline comments.


================
Comment at: flang/lib/Optimizer/CodeGen/CodeGen.cpp:26
 #include "llvm/ADT/ArrayRef.h"
+#include <mlir/IR/OperationSupport.h>
 
----------------
Is this include needed? Can you use `"`?


================
Comment at: flang/lib/Optimizer/CodeGen/CodeGen.cpp:201
+  static mlir::Type getBaseAddrTypeFromBox(mlir::Type type) {
+    return getBoxEleTy(type, {0});
+  }
----------------
Replace `0` with `kAddrPosInBox`


================
Comment at: flang/lib/Optimizer/CodeGen/CodeGen.cpp:238-240
+    auto c7 = genConstantOffset(loc, rewriter, 7);
+    auto dimValue = genConstantIndex(loc, idxTy, rewriter, dim);
+    return loadFromOffset(loc, box, c0, c7, dimValue, 2, idxTy, rewriter);
----------------



================
Comment at: flang/lib/Optimizer/CodeGen/CodeGen.cpp:2128
+            mlir::ConversionPatternRewriter &rewriter) const override {
+    auto operands = adaptor.getOperands();
+
----------------



================
Comment at: flang/lib/Optimizer/CodeGen/CodeGen.cpp:2157
+
+    // Sequence type (e.g. fir.array
+    if (auto arrTy = objectTy.dyn_cast<fir::SequenceType>()) {
----------------



================
Comment at: flang/lib/Optimizer/CodeGen/CodeGen.cpp:2203
+    if (coor.getNumOperands() == 2) {
+      auto *coordinateDef = (*coor.coor().begin()).getDefiningOp();
+      if (isa_and_nonnull<fir::LenParamIndexOp>(coordinateDef)) {
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114159/new/

https://reviews.llvm.org/D114159



More information about the llvm-commits mailing list