[llvm] r304089 - [InstrProf] Use more ArrayRef/StringRef.
Benjamin Kramer via llvm-commits
llvm-commits at lists.llvm.org
Sun May 28 06:23:02 PDT 2017
Author: d0k
Date: Sun May 28 08:23:02 2017
New Revision: 304089
URL: http://llvm.org/viewvc/llvm-project?rev=304089&view=rev
Log:
[InstrProf] Use more ArrayRef/StringRef.
No functional change intended.
Modified:
llvm/trunk/include/llvm/ProfileData/InstrProf.h
llvm/trunk/lib/ProfileData/InstrProf.cpp
Modified: llvm/trunk/include/llvm/ProfileData/InstrProf.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/InstrProf.h?rev=304089&r1=304088&r2=304089&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ProfileData/InstrProf.h (original)
+++ llvm/trunk/include/llvm/ProfileData/InstrProf.h Sun May 28 08:23:02 2017
@@ -212,12 +212,12 @@ StringRef getFuncNameWithoutPrefix(Strin
/// third field is the uncompressed strings; otherwise it is the
/// compressed string. When the string compression is off, the
/// second field will have value zero.
-Error collectPGOFuncNameStrings(const std::vector<std::string> &NameStrs,
+Error collectPGOFuncNameStrings(ArrayRef<std::string> NameStrs,
bool doCompression, std::string &Result);
/// Produce \c Result string with the same format described above. The input
/// is vector of PGO function name variables that are referenced.
-Error collectPGOFuncNameStrings(const std::vector<GlobalVariable *> &NameVars,
+Error collectPGOFuncNameStrings(ArrayRef<GlobalVariable *> NameVars,
std::string &Result, bool doCompression = true);
/// \c NameStrings is a string composed of one of more sub-strings encoded in
@@ -967,7 +967,7 @@ struct Header {
} // end namespace RawInstrProf
// Parse MemOP Size range option.
-void getMemOPSizeRangeFromOption(std::string Str, int64_t &RangeStart,
+void getMemOPSizeRangeFromOption(StringRef Str, int64_t &RangeStart,
int64_t &RangeLast);
} // end namespace llvm
Modified: llvm/trunk/lib/ProfileData/InstrProf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/InstrProf.cpp?rev=304089&r1=304088&r2=304089&view=diff
==============================================================================
--- llvm/trunk/lib/ProfileData/InstrProf.cpp (original)
+++ llvm/trunk/lib/ProfileData/InstrProf.cpp Sun May 28 08:23:02 2017
@@ -355,7 +355,7 @@ void InstrProfSymtab::create(Module &M,
finalizeSymtab();
}
-Error collectPGOFuncNameStrings(const std::vector<std::string> &NameStrs,
+Error collectPGOFuncNameStrings(ArrayRef<std::string> NameStrs,
bool doCompression, std::string &Result) {
assert(!NameStrs.empty() && "No name data to emit");
@@ -403,7 +403,7 @@ StringRef getPGOFuncNameVarInitializer(G
return NameStr;
}
-Error collectPGOFuncNameStrings(const std::vector<GlobalVariable *> &NameVars,
+Error collectPGOFuncNameStrings(ArrayRef<GlobalVariable *> NameVars,
std::string &Result, bool doCompression) {
std::vector<std::string> NameStrs;
for (auto *NameVar : NameVars) {
@@ -978,22 +978,22 @@ bool canRenameComdatFunc(const Function
}
// Parse the value profile options.
-void getMemOPSizeRangeFromOption(std::string MemOPSizeRange,
- int64_t &RangeStart, int64_t &RangeLast) {
+void getMemOPSizeRangeFromOption(StringRef MemOPSizeRange, int64_t &RangeStart,
+ int64_t &RangeLast) {
static const int64_t DefaultMemOPSizeRangeStart = 0;
static const int64_t DefaultMemOPSizeRangeLast = 8;
RangeStart = DefaultMemOPSizeRangeStart;
RangeLast = DefaultMemOPSizeRangeLast;
if (!MemOPSizeRange.empty()) {
- auto Pos = MemOPSizeRange.find(":");
+ auto Pos = MemOPSizeRange.find(':');
if (Pos != std::string::npos) {
if (Pos > 0)
- RangeStart = atoi(MemOPSizeRange.substr(0, Pos).c_str());
+ MemOPSizeRange.substr(0, Pos).getAsInteger(10, RangeStart);
if (Pos < MemOPSizeRange.size() - 1)
- RangeLast = atoi(MemOPSizeRange.substr(Pos + 1).c_str());
+ MemOPSizeRange.substr(Pos + 1).getAsInteger(10, RangeLast);
} else
- RangeLast = atoi(MemOPSizeRange.c_str());
+ MemOPSizeRange.getAsInteger(10, RangeLast);
}
assert(RangeLast >= RangeStart);
}
More information about the llvm-commits
mailing list