[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
Wed Dec 1 03:09:58 PST 2021
rovka added inline comments.
================
Comment at: flang/lib/Optimizer/CodeGen/CodeGen.cpp:2291
+ // %resultAddr = coordinate_of %box, %idx1, %idx2 : !fir.ref<f32>
+ // 2.4 (`fir.derived` inside `fir.array`)
+ mlir::LLVM::ConstantOp c0 =
----------------
Are these really the only 4 cases? Is it possible to have any combination of arrays/deriveds inside of arrays/deriveds, e.g. fir.array<M x fir.type<d1{field1:fir.array<N x fir.array <10 x i32>>, field_2:fir.type<d2{i32, i32}>}>>? Maybe a more generic sentence would work better here
================
Comment at: flang/lib/Optimizer/CodeGen/CodeGen.cpp:2311
+ mlir::Value stride =
+ loadStrideFromBox(loc, operands[0], index - i, rewriter);
+ auto sc = rewriter.create<mlir::LLVM::MulOp>(
----------------
So, IIUC, if you have coordinate_of on a fir.array<M x N x fir.array<P x i32>> with operands idx1, idx2, idx3, then you end up multiplying idx1 * **stride(operands[0], 0)**, then idx2 * stride(operands[0], 1), then idx3 * **stride(operands[0], 0)**. That sounds like you expect the same stride for the inner array as for the outer array. That doesn't seem right. Am I missing something?
Also, is it even possible to have an inner fir.array without a box? Or would you actually have fir.array<M x N x fir.box<fir.array<P x i32>>?
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