[flang-commits] [flang] [Flang][OpenMP] Correct ArrayElements in Reduction Clause (PR #196094)
Tom Eccles via flang-commits
flang-commits at lists.llvm.org
Fri May 8 06:33:15 PDT 2026
================
@@ -1592,6 +1592,29 @@ static bool hasDeferredCharacterLength(const Fortran::semantics::Symbol &sym) {
type->characterTypeSpec().length().isDeferred();
}
+static mlir::Value
+findOverriddenExprValue(const Fortran::lower::ExprToValueMap &map,
+ const Fortran::lower::SomeExpr &expr) {
+ if (auto match = map.find(&expr); match != map.end())
+ return match->second;
+
+ if (!Fortran::evaluate::IsArrayElement(expr))
+ return {};
+
+ for (auto [key, value] : map) {
+ if (key == llvm::DenseMapInfo<
+ const Fortran::lower::SomeExpr *>::getEmptyKey() ||
+ key == llvm::DenseMapInfo<
+ const Fortran::lower::SomeExpr *>::getTombstoneKey())
+ continue;
+ if (Fortran::evaluate::IsArrayElement(*key) &&
+ key->AsFortran() == expr.AsFortran())
----------------
tblah wrote:
Is this defensive programming or did you actually find cases where this caught things? I think if this is needed it would imply that we fundamentally can't trust a map keyed by SomeExpr*
https://github.com/llvm/llvm-project/pull/196094
More information about the flang-commits
mailing list