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

Diana Picus via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 3 05:48:02 PST 2021


rovka accepted this revision.
rovka added a comment.
This revision is now accepted and ready to land.

LGTM, thanks for all the changes :)



================
Comment at: flang/lib/Optimizer/CodeGen/CodeGen.cpp:2323
+        currentObjTy = arrTy.getEleTy();
+      } else if (auto seqTy = currentObjTy.dyn_cast<fir::RecordType>()) {
+        auto seqRefTy =
----------------
Microscopic nit: recTy would be more suggestive.


================
Comment at: flang/test/Fir/Todo/cordinate_of_2.fir:8
+   %idx0 = arith.constant 0 : i32
+   %q = fir.coordinate_of %arg0, %idx0, %arg1 : (!fir.box<!fir.type<derived_2{field_1:!fir.array<10 x i32>, field_2:i32}>>, i32, index) -> !fir.ref<f32>
+   return
----------------
Very small nit: Maybe also have a testcase with derived<derived<array, ...>, ...> ?


================
Comment at: flang/test/Fir/convert-to-llvm.fir:1665
+// CHECK-NEXT:    %[[DERIVED_CAST_I8_PTR:.*]] = llvm.bitcast %[[DERIVED_VAL]] : !llvm.ptr<struct<"derived_2", (struct<"another_derived", (i32, f32)>, i32)>> to !llvm.ptr<struct<"derived_2", (struct<"another_derived", (i32, f32)>, i32)>>
+// CHECK-NEXT:    %[[ANNOTHER_DERIVED_ADDR:.*]] = llvm.getelementptr %[[DERIVED_CAST_I8_PTR]][%[[C0_3]], %[[C0_0]]] : (!llvm.ptr<struct<"derived_2", (struct<"another_derived", (i32, f32)>, i32)>>, i64, i32) -> !llvm.ptr<struct<"another_derived", (i32, f32)>>
+// CHECK-NEXT:    %[[ANOTHER_DERIVED_ADDR_AS_VOID_PTR:.*]] = llvm.bitcast %[[ANNOTHER_DERIVED_ADDR]] : !llvm.ptr<struct<"another_derived", (i32, f32)>> to !llvm.ptr<i8>
----------------



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