[PATCH] D110407: [fir] Add fir.save_result op

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 24 09:48:06 PDT 2021


mehdi_amini added inline comments.


================
Comment at: flang/lib/Optimizer/Dialect/FIROps.cpp:1305
+static mlir::LogicalResult verify(fir::SaveResultOp op) {
+  auto resultType = op.value().getType();
+  if (resultType != fir::dyn_cast_ptrEleTy(op.memref().getType()))
----------------
Nit: The naming `resultType` confused me, because this is the input value to the operation and not its result (there aren't any results for this op)



================
Comment at: flang/lib/Optimizer/Dialect/FIROps.cpp:1313
+    return op.emitOpError(
+        "value operand must be a fir.box, fir.array or fir.type");
+
----------------
Side note: this is the kind of constraint that could be put in TableGen: right now you declare the value as `AnyType` but you can define another TypeConstraint there as well. Flang already defines similar constraints like `def AnyEmboxArg : Type<AnyEmboxLike.predicate, "embox argument type">;`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110407



More information about the llvm-commits mailing list