[PATCH] D114460: [fir] Add fir reduction builder

Valentin Clement via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 25 06:54:57 PST 2021


clementval added inline comments.


================
Comment at: flang/unittests/Optimizer/Builder/Runtime/ReductionTest.cpp:20
+  mlir::Value all = fir::runtime::genAll(*firBuilder, loc, undef, dim);
+  checkCallOp(all.getDefiningOp(), "_FortranAAll", 2);
+}
----------------
awarzynski wrote:
> clementval wrote:
> > awarzynski wrote:
> > > Same suggestion in other places.
> > Does this really help?
> Yes. `_FortranAll` is somewhat self-explanatory. But `2` is a magic number without the comment.
Fells like more work for not so much


================
Comment at: flang/unittests/Optimizer/Builder/Runtime/ReductionTest.cpp:25-26
+  auto loc = firBuilder->getUnknownLoc();
+  mlir::Type seqTy =
+      fir::SequenceType::get(fir::SequenceType::Shape(1, 10), i32Ty);
+  mlir::Value result = firBuilder->create<fir::UndefOp>(loc, seqTy);
----------------
awarzynski wrote:
> clementval wrote:
> > awarzynski wrote:
> > > Move next to other "// Commonly used types" in `RuntimeCallTest`?
> > Are you talking about `seqTy` or `result`? Not sure if the comment moved with the update. 
> Both are re-defined multiple times. So is `undef`, `dim` and a few other. I'd keep only keep the bare minimum in every test that's unique to a particular case being tested. Reduced code-duplication, makes this file shorter.
Values have to be created right here otherwise the test does not make sense. Type can be moved to the SetUp. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114460



More information about the llvm-commits mailing list