Skip to content

Commit 5a20a20

Browse files
authored
[flang] Resolve "possible performance problem" issue spam (#79769)
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 #79703, .../79705, .../79706, & .../79707.
1 parent 7876235 commit 5a20a20

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

flang/lib/Lower/OpenACC.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3247,7 +3247,7 @@ static void createDeclareGlobalOp(mlir::OpBuilder &modBuilder,
32473247
fir::FirOpBuilder &builder,
32483248
mlir::Location loc, fir::GlobalOp globalOp,
32493249
mlir::acc::DataClause clause,
3250-
const std::string declareGlobalName,
3250+
const std::string &declareGlobalName,
32513251
bool implicit, std::stringstream &asFortran) {
32523252
GlobalOp declareGlobalOp =
32533253
modBuilder.create<GlobalOp>(loc, declareGlobalName);

flang/lib/Optimizer/CodeGen/Target.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static const llvm::fltSemantics &floatToSemantics(const KindMapping &kindMap,
4747
}
4848

4949
static void typeTodo(const llvm::fltSemantics *sem, mlir::Location loc,
50-
std::string context) {
50+
const std::string &context) {
5151
if (sem == &llvm::APFloat::IEEEhalf()) {
5252
TODO(loc, "COMPLEX(KIND=2): for " + context + " type");
5353
} else if (sem == &llvm::APFloat::BFloat()) {

flang/lib/Parser/preprocessor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ void Preprocessor::DefineStandardMacros() {
252252
Define("__LINE__"s, "__LINE__"s);
253253
}
254254

255-
void Preprocessor::Define(std::string macro, std::string value) {
255+
void Preprocessor::Define(const std::string &macro, const std::string &value) {
256256
definitions_.emplace(SaveTokenAsName(macro), Definition{value, allSources_});
257257
}
258258

flang/lib/Parser/preprocessor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class Preprocessor {
7070
AllSources &allSources() { return allSources_; }
7171

7272
void DefineStandardMacros();
73-
void Define(std::string macro, std::string value);
73+
void Define(const std::string &macro, const std::string &value);
7474
void Undefine(std::string macro);
7575
bool IsNameDefined(const CharBlock &);
7676
bool IsFunctionLikeDefinition(const CharBlock &);

flang/lib/Semantics/check-directive-structure.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ template <typename D, typename C, typename PC, std::size_t ClauseEnumSize>
176176
class DirectiveStructureChecker : public virtual BaseChecker {
177177
protected:
178178
DirectiveStructureChecker(SemanticsContext &context,
179-
std::unordered_map<D, DirectiveClauses<C, ClauseEnumSize>>
180-
directiveClausesMap)
179+
const std::unordered_map<D, DirectiveClauses<C, ClauseEnumSize>>
180+
&directiveClausesMap)
181181
: context_{context}, directiveClausesMap_(directiveClausesMap) {}
182182
virtual ~DirectiveStructureChecker() {}
183183

0 commit comments

Comments
 (0)