[MIR] Speedup parsing of function with large number of basic blocks

Patch eliminates string length calculation when lexing a token. Speedup can be up to
1000x.

Differential revision: https://reviews.llvm.org/D83389
This commit is contained in:
Evgeny Leviant 2020-07-08 18:50:00 +03:00
parent 470bf7b5a2
commit a074984250
1 changed files with 1 additions and 1 deletions

View File

@ -563,7 +563,7 @@ MIParser::MIParser(PerFunctionMIParsingState &PFS, SMDiagnostic &Error,
void MIParser::lex(unsigned SkipChar) {
CurrentSource = lexMIToken(
CurrentSource.data() + SkipChar, Token,
CurrentSource.slice(SkipChar, StringRef::npos), Token,
[this](StringRef::iterator Loc, const Twine &Msg) { error(Loc, Msg); });
}