[flang-commits] [flang] [flang][OpenMP] simplify getReductionName (PR #85956)
via flang-commits
flang-commits at lists.llvm.org
Wed Mar 20 09:08:04 PDT 2024
https://github.com/wallfIower created https://github.com/llvm/llvm-project/pull/85956
None
>From 436c678fbb6eeee10f2950723c38889735ba150e Mon Sep 17 00:00:00 2001
From: LL <LL at cock.pm>
Date: Wed, 20 Mar 2024 16:07:50 +0000
Subject: [PATCH] [flang][OpenMP] simplify getReductionName
---
flang/lib/Lower/OpenMP/ReductionProcessor.cpp | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/flang/lib/Lower/OpenMP/ReductionProcessor.cpp b/flang/lib/Lower/OpenMP/ReductionProcessor.cpp
index 2477f635792a25..6ed7d397048a36 100644
--- a/flang/lib/Lower/OpenMP/ReductionProcessor.cpp
+++ b/flang/lib/Lower/OpenMP/ReductionProcessor.cpp
@@ -81,10 +81,13 @@ bool ReductionProcessor::supportedIntrinsicProcReduction(
return redType;
}
-std::string
-ReductionProcessor::getReductionName(llvm::StringRef name,
- const fir::KindMapping &kindMap,
- mlir::Type ty, bool isByRef) {
+std::string ReductionProcessor::getReductionName(
+ llvm::StringRef name, const fir::KindMapping& kindMap, mlir::Type ty, bool isByRef) {
+ ty = fir::unwrapRefType(ty);
+ std::string byrefSuffix = isByRef ? "_byref" : "";
+ std::string typeString = fir::getTypeAsString(ty, kindMap, "");
+ return name.str() + byrefSuffix + typeString;
+}
ty = fir::unwrapRefType(ty);
// extra string to distinguish reduction functions for variables passed by
@@ -93,7 +96,9 @@ ReductionProcessor::getReductionName(llvm::StringRef name,
if (isByRef)
byrefAddition = "_byref";
- return fir::getTypeAsString(ty, kindMap, (name + byrefAddition).str());
+std::string resultName = name.str() + byrefAddition;
+return fir::getTypeAsString(ty, kindMap, resultName);
+
}
std::string ReductionProcessor::getReductionName(
More information about the flang-commits
mailing list