[flang-commits] [flang] [flang][OpenMP] simplify getReductionName (PR #85956)
via flang-commits
flang-commits at lists.llvm.org
Wed Mar 20 09:09:03 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-fir-hlfir
Author: LL (wallfIower)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/85956.diff
1 Files Affected:
- (modified) flang/lib/Lower/OpenMP/ReductionProcessor.cpp (+10-5)
``````````diff
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(
``````````
</details>
https://github.com/llvm/llvm-project/pull/85956
More information about the flang-commits
mailing list