[InstrProf] Use more ArrayRef/StringRef.

No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304089 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer 2017-05-28 13:23:02 +00:00
parent 0ccceac14c
commit 0dbb1537bc
2 changed files with 11 additions and 11 deletions

View File

@ -212,12 +212,12 @@ StringRef getFuncNameWithoutPrefix(StringRef PGOFuncName,
/// third field is the uncompressed strings; otherwise it is the /// third field is the uncompressed strings; otherwise it is the
/// compressed string. When the string compression is off, the /// compressed string. When the string compression is off, the
/// second field will have value zero. /// 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); bool doCompression, std::string &Result);
/// Produce \c Result string with the same format described above. The input /// Produce \c Result string with the same format described above. The input
/// is vector of PGO function name variables that are referenced. /// 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); std::string &Result, bool doCompression = true);
/// \c NameStrings is a string composed of one of more sub-strings encoded in /// \c NameStrings is a string composed of one of more sub-strings encoded in
@ -967,7 +967,7 @@ struct Header {
} // end namespace RawInstrProf } // end namespace RawInstrProf
// Parse MemOP Size range option. // Parse MemOP Size range option.
void getMemOPSizeRangeFromOption(std::string Str, int64_t &RangeStart, void getMemOPSizeRangeFromOption(StringRef Str, int64_t &RangeStart,
int64_t &RangeLast); int64_t &RangeLast);
} // end namespace llvm } // end namespace llvm

View File

@ -355,7 +355,7 @@ void InstrProfSymtab::create(Module &M, bool InLTO) {
finalizeSymtab(); finalizeSymtab();
} }
Error collectPGOFuncNameStrings(const std::vector<std::string> &NameStrs, Error collectPGOFuncNameStrings(ArrayRef<std::string> NameStrs,
bool doCompression, std::string &Result) { bool doCompression, std::string &Result) {
assert(!NameStrs.empty() && "No name data to emit"); assert(!NameStrs.empty() && "No name data to emit");
@ -403,7 +403,7 @@ StringRef getPGOFuncNameVarInitializer(GlobalVariable *NameVar) {
return NameStr; return NameStr;
} }
Error collectPGOFuncNameStrings(const std::vector<GlobalVariable *> &NameVars, Error collectPGOFuncNameStrings(ArrayRef<GlobalVariable *> NameVars,
std::string &Result, bool doCompression) { std::string &Result, bool doCompression) {
std::vector<std::string> NameStrs; std::vector<std::string> NameStrs;
for (auto *NameVar : NameVars) { for (auto *NameVar : NameVars) {
@ -978,22 +978,22 @@ bool canRenameComdatFunc(const Function &F, bool CheckAddressTaken) {
} }
// Parse the value profile options. // Parse the value profile options.
void getMemOPSizeRangeFromOption(std::string MemOPSizeRange, void getMemOPSizeRangeFromOption(StringRef MemOPSizeRange, int64_t &RangeStart,
int64_t &RangeStart, int64_t &RangeLast) { int64_t &RangeLast) {
static const int64_t DefaultMemOPSizeRangeStart = 0; static const int64_t DefaultMemOPSizeRangeStart = 0;
static const int64_t DefaultMemOPSizeRangeLast = 8; static const int64_t DefaultMemOPSizeRangeLast = 8;
RangeStart = DefaultMemOPSizeRangeStart; RangeStart = DefaultMemOPSizeRangeStart;
RangeLast = DefaultMemOPSizeRangeLast; RangeLast = DefaultMemOPSizeRangeLast;
if (!MemOPSizeRange.empty()) { if (!MemOPSizeRange.empty()) {
auto Pos = MemOPSizeRange.find(":"); auto Pos = MemOPSizeRange.find(':');
if (Pos != std::string::npos) { if (Pos != std::string::npos) {
if (Pos > 0) if (Pos > 0)
RangeStart = atoi(MemOPSizeRange.substr(0, Pos).c_str()); MemOPSizeRange.substr(0, Pos).getAsInteger(10, RangeStart);
if (Pos < MemOPSizeRange.size() - 1) if (Pos < MemOPSizeRange.size() - 1)
RangeLast = atoi(MemOPSizeRange.substr(Pos + 1).c_str()); MemOPSizeRange.substr(Pos + 1).getAsInteger(10, RangeLast);
} else } else
RangeLast = atoi(MemOPSizeRange.c_str()); MemOPSizeRange.getAsInteger(10, RangeLast);
} }
assert(RangeLast >= RangeStart); assert(RangeLast >= RangeStart);
} }