[flang-commits] [flang] [flang] Resolve "possible performance problem" issue spam (PR #79769)
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Fri Feb 2 08:49:52 PST 2024
https://github.com/klausler updated https://github.com/llvm/llvm-project/pull/79769
>From 70b6b7d954cfa6db506616d84fb868699dec1a57 Mon Sep 17 00:00:00 2001
From: Peter Klausler <pklausler at nvidia.com>
Date: Sun, 28 Jan 2024 13:06:12 -0800
Subject: [PATCH] [flang] Resolve "possible performance problem" issue spam
Four "issues" on GitHub report possible performance problems,
likely detected by static analysis. None of them would ever
make a measureable difference in compilation time, but I'm
resolving them to clean up the open issues list.
Fixes https://github.com/llvm/llvm-project/issues/79703,
https://github.com/llvm/llvm-project/issues/79705,
https://github.com/llvm/llvm-project/issues/79706, &
https://github.com/llvm/llvm-project/issues/79707.
---
flang/lib/Lower/OpenACC.cpp | 2 +-
flang/lib/Optimizer/CodeGen/Target.cpp | 2 +-
flang/lib/Parser/preprocessor.cpp | 2 +-
flang/lib/Parser/preprocessor.h | 2 +-
flang/lib/Semantics/check-directive-structure.h | 4 ++--
5 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/flang/lib/Lower/OpenACC.cpp b/flang/lib/Lower/OpenACC.cpp
index 43f54c6d2a71b..cba94cb5f6dd9 100644
--- a/flang/lib/Lower/OpenACC.cpp
+++ b/flang/lib/Lower/OpenACC.cpp
@@ -3229,7 +3229,7 @@ static void createDeclareGlobalOp(mlir::OpBuilder &modBuilder,
fir::FirOpBuilder &builder,
mlir::Location loc, fir::GlobalOp globalOp,
mlir::acc::DataClause clause,
- const std::string declareGlobalName,
+ const std::string &declareGlobalName,
bool implicit, std::stringstream &asFortran) {
GlobalOp declareGlobalOp =
modBuilder.create<GlobalOp>(loc, declareGlobalName);
diff --git a/flang/lib/Optimizer/CodeGen/Target.cpp b/flang/lib/Optimizer/CodeGen/Target.cpp
index 19730f7a64337..7c77bdd79008f 100644
--- a/flang/lib/Optimizer/CodeGen/Target.cpp
+++ b/flang/lib/Optimizer/CodeGen/Target.cpp
@@ -47,7 +47,7 @@ static const llvm::fltSemantics &floatToSemantics(const KindMapping &kindMap,
}
static void typeTodo(const llvm::fltSemantics *sem, mlir::Location loc,
- std::string context) {
+ const std::string &context) {
if (sem == &llvm::APFloat::IEEEhalf()) {
TODO(loc, "COMPLEX(KIND=2): for " + context + " type");
} else if (sem == &llvm::APFloat::BFloat()) {
diff --git a/flang/lib/Parser/preprocessor.cpp b/flang/lib/Parser/preprocessor.cpp
index 10661dda32bc3..464de006b90ec 100644
--- a/flang/lib/Parser/preprocessor.cpp
+++ b/flang/lib/Parser/preprocessor.cpp
@@ -252,7 +252,7 @@ void Preprocessor::DefineStandardMacros() {
Define("__LINE__"s, "__LINE__"s);
}
-void Preprocessor::Define(std::string macro, std::string value) {
+void Preprocessor::Define(const std::string ¯o, const std::string &value) {
definitions_.emplace(SaveTokenAsName(macro), Definition{value, allSources_});
}
diff --git a/flang/lib/Parser/preprocessor.h b/flang/lib/Parser/preprocessor.h
index 3b456364944c3..b61f1577727be 100644
--- a/flang/lib/Parser/preprocessor.h
+++ b/flang/lib/Parser/preprocessor.h
@@ -70,7 +70,7 @@ class Preprocessor {
AllSources &allSources() { return allSources_; }
void DefineStandardMacros();
- void Define(std::string macro, std::string value);
+ void Define(const std::string ¯o, const std::string &value);
void Undefine(std::string macro);
bool IsNameDefined(const CharBlock &);
bool IsFunctionLikeDefinition(const CharBlock &);
diff --git a/flang/lib/Semantics/check-directive-structure.h b/flang/lib/Semantics/check-directive-structure.h
index 829405f99d64c..97e13c59ac416 100644
--- a/flang/lib/Semantics/check-directive-structure.h
+++ b/flang/lib/Semantics/check-directive-structure.h
@@ -176,8 +176,8 @@ template <typename D, typename C, typename PC, std::size_t ClauseEnumSize>
class DirectiveStructureChecker : public virtual BaseChecker {
protected:
DirectiveStructureChecker(SemanticsContext &context,
- std::unordered_map<D, DirectiveClauses<C, ClauseEnumSize>>
- directiveClausesMap)
+ const std::unordered_map<D, DirectiveClauses<C, ClauseEnumSize>>
+ &directiveClausesMap)
: context_{context}, directiveClausesMap_(directiveClausesMap) {}
virtual ~DirectiveStructureChecker() {}
More information about the flang-commits
mailing list