[PATCH] D114535: [fir] Add fir ragged array builder

Valentin Clement via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 8 06:20:16 PST 2021


clementval added inline comments.


================
Comment at: flang/lib/Optimizer/Builder/Runtime/Ragged.cpp:35
+  auto ptrTy = builder.getRefType(eleTy.cast<mlir::TupleType>().getType(1));
+  auto ptr = builder.create<fir::CoordinateOp>(loc, ptrTy, header, one);
+  auto heap = builder.create<fir::LoadOp>(loc, ptr);
----------------
kiranchandramohan wrote:
> I guess this is two now, right?
Good catch. Updated and I added a comment for this magic number. 


================
Comment at: flang/unittests/Optimizer/Builder/Runtime/RaggedTest.cpp:19
+      fir::SequenceType::get(fir::SequenceType::Shape(1, 10), tupleTy);
+  mlir::Value header = firBuilder->create<fir::UndefOp>(loc, seqTy);
+  mlir::Value eleSize = firBuilder->createIntegerConstant(loc, i32Ty, 1);
----------------
kiranchandramohan wrote:
> Nit: I guess this is not a true representation of a header.
> But I guess it is OK since we are not testing the structure of the header.
> 
> Also, is the tupleTy/pair due to the previous representation of the raggedArrayHeader?
There is actually a helper function in the FIRBuilder for that so I just bring it in with this patch. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114535



More information about the llvm-commits mailing list