[flang-commits] [flang] [flang][OpenMP] simplify getReductionName (PR #85956)
via flang-commits
flang-commits at lists.llvm.org
Wed Mar 20 09:20:37 PDT 2024
https://github.com/wallfIower updated https://github.com/llvm/llvm-project/pull/85956
>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 1/2] [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(
>From 2bce471967733dd0b780dfc89f945a0f271a61a4 Mon Sep 17 00:00:00 2001
From: LL <LL at cock.pm>
Date: Wed, 20 Mar 2024 16:20:29 +0000
Subject: [PATCH 2/2] [flang][OpenMP] simplify getReductionName
---
flang/lib/Lower/OpenMP/ReductionProcessor.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/flang/lib/Lower/OpenMP/ReductionProcessor.cpp b/flang/lib/Lower/OpenMP/ReductionProcessor.cpp
index 6ed7d397048a36..00fc70b519b5aa 100644
--- a/flang/lib/Lower/OpenMP/ReductionProcessor.cpp
+++ b/flang/lib/Lower/OpenMP/ReductionProcessor.cpp
@@ -81,13 +81,15 @@ 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
More information about the flang-commits
mailing list