[all-commits] [llvm/llvm-project] 969e7e: [SourceMgr/MLIR diagnostics] Introduce a new metho...

Chris Lattner via All-commits all-commits at lists.llvm.org
Sat Apr 25 14:08:33 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 969e7edd88ceb4791eb1cac22828290f0ae30b3d
      https://github.com/llvm/llvm-project/commit/969e7edd88ceb4791eb1cac22828290f0ae30b3d
  Author: Chris Lattner <clattner at nondot.org>
  Date:   2020-04-25 (Sat, 25 Apr 2020)

  Changed paths:
    M llvm/include/llvm/Support/SourceMgr.h
    M llvm/lib/Support/SourceMgr.cpp
    M mlir/lib/IR/Diagnostics.cpp

  Log Message:
  -----------
  [SourceMgr/MLIR diagnostics] Introduce a new method to speed things up

Summary:
This introduces a new SourceMgr::FindLocForLineAndColumn method that
uses the OffsetCache in SourceMgr::SrcBuffer to do do a constant time
lookup for the line number (once the cache is populated).

Use this method in MLIR's SourceMgrDiagnosticHandler::convertLocToSMLoc,
replacing the O(n) scanning logic.  This resolves a long standing TODO
in MLIR, and makes one of my usecases go dramatically faster (which is
currently producing many diagnostics in a 40MB SourceBuffer).

NFC, this is just a performance speedup and cleanup.

Reviewers: rriddle!, ftynse!

Subscribers: hiraditya, mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, grosul1, frgossen, Kayjukh, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D78868




More information about the All-commits mailing list