[flang-commits] [flang] [Flang][OpenMP] Consider renames when processing reduction intrinsics (PR #70822)
Kiran Chandramohan via flang-commits
flang-commits at lists.llvm.org
Thu Nov 23 05:23:39 PST 2023
================
@@ -480,21 +480,28 @@ class OmpAttributeVisitor : DirectiveAttributeVisitor<llvm::omp::Directive> {
bool Pre(const parser::OmpClause::Reduction &x) {
const parser::OmpReductionOperator &opr{
std::get<parser::OmpReductionOperator>(x.v.t)};
+ auto createDummyProcSymbol = [&](const parser::Name *name) {
+ // If name resolution failed, create a dummy symbol
+ const auto namePair{
+ currScope().try_emplace(name->source, Attrs{}, ProcEntityDetails{})};
+ auto &newSymbol{*namePair.first->second};
+ name->symbol = &newSymbol;
+ };
if (const auto *procD{parser::Unwrap<parser::ProcedureDesignator>(opr.u)}) {
if (const auto *name{parser::Unwrap<parser::Name>(procD->u)}) {
if (!name->symbol) {
- const auto namePair{currScope().try_emplace(
- name->source, Attrs{}, ProcEntityDetails{})};
- auto &symbol{*namePair.first->second};
- name->symbol = &symbol;
- name->symbol->set(Symbol::Flag::OmpReduction);
----------------
kiranchandramohan wrote:
This is currently only used for the variable that is present in the reduction clause and not for the function/operation. For supporting user-defined reductions, this might be needed in future, but at the moment there is no use either in semantics or lowering.
https://github.com/llvm/llvm-project/pull/70822
More information about the flang-commits
mailing list