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

Valentin Clement via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 9 07:57:40 PST 2021


clementval added inline comments.


================
Comment at: flang/lib/Optimizer/CodeGen/CodeGen.cpp:2612
+    // Boxed type - get the base pointer from the box
+    if (baseObjectTy.dyn_cast<fir::BoxType>()) {
+      return doRewriteBox(coor, ty, operands, loc, rewriter);
----------------
Remove brace on simple single statement


================
Comment at: flang/lib/Optimizer/CodeGen/CodeGen.cpp:2617
+    // Reference type
+    if (baseObjectTy.dyn_cast<fir::ReferenceType>()) {
+      return doRewriteRef(coor, ty, operands, loc, rewriter);
----------------
Remove brace on simple single statement


================
Comment at: flang/lib/Optimizer/CodeGen/CodeGen.cpp:2680
+  bool arraysHaveKnownShape(mlir::Type type, mlir::ValueRange coors) const {
+    const auto sz = coors.size();
+    std::remove_const_t<decltype(sz)> i = 0;
----------------
clementval wrote:
> replace `auto`



================
Comment at: flang/lib/Optimizer/CodeGen/CodeGen.cpp:2681
+    const auto sz = coors.size();
+    std::remove_const_t<decltype(sz)> i = 0;
+    for (; i < sz; ++i) {
----------------



================
Comment at: flang/lib/Optimizer/CodeGen/CodeGen.cpp:2823
+          bool allConst = true;
+          for (std::remove_const_t<decltype(sz)> i = 0; i < sz - 1; ++i)
+            if (shape[i] < 0) {
----------------



================
Comment at: flang/lib/Optimizer/CodeGen/CodeGen.cpp:2823
+          bool allConst = true;
+          for (std::remove_const_t<decltype(sz)> i = 0; i < sz - 1; ++i)
+            if (shape[i] < 0) {
----------------
clementval wrote:
> 
Maybe adding braces here would help readability. 


================
Comment at: flang/lib/Optimizer/CodeGen/CodeGen.cpp:2850
+      SmallVector<mlir::Value> arrIdx;
+      for (std::remove_const_t<decltype(sz)> i = 1; i < sz; ++i) {
+        auto nxtOpnd = operands[i];
----------------



================
Comment at: flang/lib/Optimizer/CodeGen/CodeGen.cpp:2884
+        // check if the i-th coordinate relates to a field
+        if (auto strTy = currentObjTy.dyn_cast<fir::RecordType>()) {
+          currentObjTy = strTy.getType(getFieldNumber(strTy, nxtOpnd));
----------------
Remove braces


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115333



More information about the llvm-commits mailing list