[flang-commits] [flang] [llvm] [mlir] [flang][MLIR][OpenMP] make reduction by-ref toggled per variable (PR #92244)
Kiran Chandramohan via flang-commits
flang-commits at lists.llvm.org
Thu May 16 03:46:08 PDT 2024
================
@@ -919,13 +923,21 @@ inlineOmpRegionCleanup(llvm::SmallVectorImpl<Region *> &cleanupRegions,
return success();
}
+static ArrayRef<bool> getIsByRef(std::optional<ArrayRef<bool>> attr) {
+ if (!attr)
+ return {};
+ return *attr;
+}
+
/// Converts an OpenMP workshare loop into LLVM IR using OpenMPIRBuilder.
static LogicalResult
convertOmpWsloop(Operation &opInst, llvm::IRBuilderBase &builder,
LLVM::ModuleTranslation &moduleTranslation) {
auto wsloopOp = cast<omp::WsloopOp>(opInst);
auto loopOp = cast<omp::LoopNestOp>(wsloopOp.getWrappedLoop());
- const bool isByRef = wsloopOp.getByref();
+
+ llvm::ArrayRef<bool> isByRef = getIsByRef(wsloopOp.getReductionVarsByref());
+ assert(isByRef.size() == wsloopOp.getNumReductionVars());
----------------
kiranchandramohan wrote:
Isn't this guaranteed by the verifier?
https://github.com/llvm/llvm-project/pull/92244
More information about the flang-commits
mailing list