[all-commits] [llvm/llvm-project] 3b4322: [Reland] [mlir] Speed up Lexer::getEncodedSourceLo...

River Riddle via All-commits all-commits at lists.llvm.org
Wed May 19 12:57:45 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3b43226032e3b1ce866c9a3aaf7eaa680fd2252a
      https://github.com/llvm/llvm-project/commit/3b43226032e3b1ce866c9a3aaf7eaa680fd2252a
  Author: River Riddle <riddleriver at gmail.com>
  Date:   2021-05-19 (Wed, 19 May 2021)

  Changed paths:
    M mlir/lib/Parser/Lexer.cpp

  Log Message:
  -----------
  [Reland] [mlir] Speed up Lexer::getEncodedSourceLocation

Reland Note: This was accidentally reverted in 80d981eda69f1ada6d944ed89571456cad13b850, but is an important improvement even outside of the driving motivator in D102567.

We currently use SourceMgr::getLineAndColumn to get the line and column for an SMLoc, but this includes a call to StringRef::find_last_of that ends up dominating compile time. In D102567, we start creating locations from the input file for block arguments which resulted in an extreme performance regression for modules with very large amounts of block arguments. This revision switches to just using a pointer offset from the beginning of the line to calculate the column(all MLIR files are simple ascii), resulting in a compile time reduction from 4700 seconds (1 hour and 18 minutes) to 8 seconds.




More information about the All-commits mailing list