[PATCH] D113551: [fir] Add fir.box_rank, fir.box_addr, fir.box_dims and fir.box_elesize conversion

Valentin Clement via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 10 06:10:51 PST 2021


clementval added inline comments.


================
Comment at: flang/lib/Optimizer/CodeGen/CodeGen.cpp:73
+                 mlir::ConversionPatternRewriter &rewriter) const {
+    mlir::LLVM::ConstantOp c0 = genConstantOffset(loc, rewriter, 0);
+    mlir::LLVM::ConstantOp cDims =
----------------
awarzynski wrote:
> [nit]
This is always 0. 


================
Comment at: flang/lib/Optimizer/CodeGen/CodeGen.cpp:111-113
+    mlir::LLVM::ConstantOp c0 = genConstantOffset(loc, rewriter, 0);
+    mlir::LLVM::ConstantOp c1 =
+        genConstantOffset(loc, rewriter, kElemLenPosInBox);
----------------
awarzynski wrote:
> `c0` is the offset to get the relevant struct (i.e. to get the base address), and `c1` is the offset within the struct (i.e. to get the element address), right?
Yes that's right. c0 is always 0 when accessing the box. 


================
Comment at: flang/lib/Optimizer/CodeGen/CodeGen.cpp:123
+                           mlir::Value base, ARGS... args) const {
+    SmallVector<mlir::Value> cv{args...};
+    return rewriter.create<mlir::LLVM::GEPOp>(loc, ty, base, cv);
----------------
awarzynski wrote:
> What's `cv`?
constant values.


================
Comment at: flang/lib/Optimizer/CodeGen/CodeGen.cpp:228
+/// the box.
+/// The rank is in 3rd position in the box.
+struct BoxRankOpConversion : public FIROpConversion<fir::BoxRankOp> {
----------------
awarzynski wrote:
> DELETEME
> 
> This is an implementation detail from `getRankFromBox`.
My bad. Was left from the code when there was not constant for the different positions. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113551



More information about the llvm-commits mailing list