[PATCH] D110415: [fir] Update fir.alloca op

Valentin Clement via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 25 05:18:15 PDT 2021


clementval added inline comments.


================
Comment at: flang/include/flang/Optimizer/Dialect/FIROps.td:288
 
-  let verifier = allocVerify#[{
-    mlir::Type outType = getType();
-    if (!outType.isa<fir::ReferenceType>())
-      return emitOpError("must be a !fir.ref type");
-    if (fir::isa_unknown_size_box(fir::dyn_cast_ptrEleTy(outType)))
-      return emitOpError("cannot allocate !fir.box of unknown rank or type");
-    return mlir::success();
-  }];
+  let parser = "return parseAlloca(parser, result);";
+  let printer = "printAlloca(p, *this);";
----------------
mehdi_amini wrote:
> Why not save an indirection and write directly here: `return parseAllocatableOp(wrapAllocaResultType, parser, result);`?
> 
Yep makes sense. 


================
Comment at: flang/include/flang/Optimizer/Dialect/FIROps.td:289
+  let parser = "return parseAlloca(parser, result);";
+  let printer = "printAlloca(p, *this);";
+
----------------
mehdi_amini wrote:
> (same here: `  printAllocatableOp(p, this);`)
+1


================
Comment at: flang/lib/Optimizer/Dialect/FIROps.cpp:171
+                          mlir::OperationState &result, mlir::Type in_type,
+                          llvm::StringRef uniq_name,
+                          mlir::ValueRange typeparams, mlir::ValueRange shape,
----------------
mehdi_amini wrote:
> Is clang-tidy right here or is the clang-tidy configuration incorrect?
Good catch. Looks like we have mixed style in some places. I'll fix that. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110415



More information about the llvm-commits mailing list