[llvm] 3905724 - [RISCV] Use std::map::count != 0 instead of std::map::count == 1. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 27 12:16:50 PST 2022
Author: Craig Topper
Date: 2022-01-27T12:16:42-08:00
New Revision: 39057240f59b348e42c9807ab0d6eb85ccc229ad
URL: https://github.com/llvm/llvm-project/commit/39057240f59b348e42c9807ab0d6eb85ccc229ad
DIFF: https://github.com/llvm/llvm-project/commit/39057240f59b348e42c9807ab0d6eb85ccc229ad.diff
LOG: [RISCV] Use std::map::count != 0 instead of std::map::count == 1. NFC
Maps always return 0 or 1 for count. Comparing to 0 can create
simpler compiled code.
Someday we'll get to use std::map::contains.
Added:
Modified:
llvm/lib/Support/RISCVISAInfo.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Support/RISCVISAInfo.cpp b/llvm/lib/Support/RISCVISAInfo.cpp
index 6c59d8a7ef047..97baf3df56f83 100644
--- a/llvm/lib/Support/RISCVISAInfo.cpp
+++ b/llvm/lib/Support/RISCVISAInfo.cpp
@@ -699,13 +699,13 @@ RISCVISAInfo::parseArchString(StringRef Arch, bool EnableExperimentalExtension,
Error RISCVISAInfo::checkDependency() {
bool IsRv32 = XLen == 32;
- bool HasE = Exts.count("e") == 1;
- bool HasD = Exts.count("d") == 1;
- bool HasF = Exts.count("f") == 1;
- bool HasZve32x = Exts.count("zve32x") == 1;
- bool HasZve32f = Exts.count("zve32f") == 1;
- bool HasZve64d = Exts.count("zve64d") == 1;
- bool HasV = Exts.count("v") == 1;
+ bool HasE = Exts.count("e") != 0;
+ bool HasD = Exts.count("d") != 0;
+ bool HasF = Exts.count("f") != 0;
+ bool HasZve32x = Exts.count("zve32x") != 0;
+ bool HasZve32f = Exts.count("zve32f") != 0;
+ bool HasZve64d = Exts.count("zve64d") != 0;
+ bool HasV = Exts.count("v") != 0;
bool HasVector = HasZve32x || HasV;
bool HasZvl = MinVLen != 0;
@@ -810,8 +810,8 @@ static constexpr ImpliedExtsEntry ImpliedExts[] = {
};
void RISCVISAInfo::updateImplication() {
- bool HasE = Exts.count("e") == 1;
- bool HasI = Exts.count("i") == 1;
+ bool HasE = Exts.count("e") != 0;
+ bool HasI = Exts.count("i") != 0;
// If not in e extension and i extension does not exist, i extension is
// implied
More information about the llvm-commits
mailing list