[flang-commits] [flang] [Flang][OpenMP] Correct ArrayElements in Reduction Clause (PR #196094)
Jack Styles via flang-commits
flang-commits at lists.llvm.org
Wed Jul 1 06:38:53 PDT 2026
================
@@ -1587,6 +1415,188 @@ struct OpWithBodyGenInfo {
bool privatize = true;
};
+static mlir::Value getReductionOverrideValue(fir::FirOpBuilder &builder,
+ mlir::Location loc,
+ const Object *object,
+ mlir::BlockArgument arg) {
+ if (hlfir::isFortranEntityWithAttributes(arg))
+ return arg;
+
+ fir::FortranVariableFlagsAttr attributes;
+ llvm::SmallVector<mlir::Value> typeParams;
+ auto declareOp = hlfir::DeclareOp::create(
+ builder, loc, arg, "omp.reduction.element", nullptr, typeParams, nullptr,
+ nullptr, 0, attributes);
+ return declareOp.getBase();
+}
+
+static void
+addReductionObjectOverrides(fir::FirOpBuilder &builder, mlir::Location loc,
+ lower::ExprToValueMap &overrides,
+ const ObjectEntryBlockArgsEntry &entry,
+ llvm::ArrayRef<mlir::BlockArgument> blockArgs) {
+ if (entry.objects.empty())
+ return;
+
+ assert(entry.objects.size() == blockArgs.size() &&
+ "reduction object list must match block arguments");
+ for (auto pair : llvm::zip_equal(entry.objects, blockArgs)) {
----------------
Stylie777 wrote:
Yes it does, I've removed this assert.
https://github.com/llvm/llvm-project/pull/196094
More information about the flang-commits
mailing list