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

Evgeny Leviant via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 8 08:50:20 PDT 2020


Author: Evgeny Leviant
Date: 2020-07-08T18:50:00+03:00
New Revision: a07498425099adbae38d3e8b01a0097fd6791c68

URL: https://github.com/llvm/llvm-project/commit/a07498425099adbae38d3e8b01a0097fd6791c68
DIFF: https://github.com/llvm/llvm-project/commit/a07498425099adbae38d3e8b01a0097fd6791c68.diff

LOG: [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

Added: 
    

Modified: 
    llvm/lib/CodeGen/MIRParser/MIParser.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/MIRParser/MIParser.cpp b/llvm/lib/CodeGen/MIRParser/MIParser.cpp
index d6bf273433a2..ded31cd08fb5 100644
--- a/llvm/lib/CodeGen/MIRParser/MIParser.cpp
+++ b/llvm/lib/CodeGen/MIRParser/MIParser.cpp
@@ -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); });
 }
 


        


More information about the llvm-commits mailing list