[PATCH] D119657: [OpenMP][mlir] Lowering for omp.atomic.update

Shraiysh via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 13 08:38:38 PST 2022


shraiysh added inline comments.


================
Comment at: mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp:992
+                       LLVM::ModuleTranslation &moduleTranslation) {
+  // Boilerplate.
+  llvm::OpenMPIRBuilder *ompBuilder = moduleTranslation.getOpenMPBuilder();
----------------
ftynse wrote:
> This comment is not helpful, we can see it is boilerplate. I would rather have most of it factored out into a function like `getOpenMPLoc(IRBuilderBase &)`.
For the function `getOpenMPLoc`, we would need `opInst` and `moduleTranslation` too. Plus, `llvm::OpenMPIRBuilder::LocationDescription` doesn't have a copy constructor, so that would also have to be passed. Also, the `ompBuilder` is used later in this function, so that cannot be pushed into the function. At this point, a function like the following doesn't feel like it is worth it. I have removed the comment as suggested. Let me know if you have any suggestions for an alternative.
```getOpenMPLoc(Operation &opInst, llvm::IRBuilderBase &builder, LLVM::ModuleTranslation moduleTranslation, llvm::OpenMPIRBuilder::LocationDescription &ompLoc)``` 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119657



More information about the llvm-commits mailing list