[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 9f384ed588
commit dc367e49cc

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); });
}