[PATCH] D78868: [SourceMgr/MLIR diagnostics] Introduce a new method to speed things up
Chris Lattner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 25 12:12:08 PDT 2020
lattner created this revision.
Herald added subscribers: llvm-commits, Kayjukh, frgossen, grosul1, Joonsoo, liufengdb, lucyrfox, mgester, arpith-jacob, nicolasvasilache, antiagainst, shauheen, jpienaar, rriddle, mehdi_amini, hiraditya.
Herald added a reviewer: rriddle.
Herald added a reviewer: ftynse.
Herald added a project: LLVM.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D78868
Files:
llvm/include/llvm/Support/SourceMgr.h
llvm/lib/Support/SourceMgr.cpp
mlir/lib/IR/Diagnostics.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78868.260130.patch
Type: text/x-patch
Size: 23762 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200425/df03304d/attachment.bin>
More information about the llvm-commits
mailing list