#
54fe208a |
| 07-Apr-2018 |
Graydon Hoare <ghoare@apple.com> |
[Support] Make line-number cache robust against access patterns.
Summary: The LLVM SourceMgr class (which is used indirectly by Swift, though not Clang) has a routine for looking up line numbers of
[Support] Make line-number cache robust against access patterns.
Summary: The LLVM SourceMgr class (which is used indirectly by Swift, though not Clang) has a routine for looking up line numbers of SMLocs. This routine uses a shared, special-purpose cache that handles exactly one access pattern efficiently: looking up the line number of an SMLoc that points into the same buffer as the last query made to the SourceMgr, at a location in the buffer at or ahead of the last query.
When this works it's fine, but when it fails it's catastrophic for performancer: one recent out-of-order access from a Swift utility routine ran for tens of seconds, spending 99% of its time repeatedly scanning buffers for '\n'.
This change removes the shared cache from the SourceMgr and installs a new cache in each SrcBuffer. The per-SrcBuffer caches are also "full", in the sense that rather than caching a single last-query pointer, they cache _all_ the line-ending offsets, in a binary-searchable array, such that once it's populated (on first access), all subsequent access patterns run at the same speed.
Performance measurements I've done show this is actually a little bit faster on real codebases (though only a couple fractions of a percent). Memory usage is up by a few tens to hundreds of bytes per SrcBuffer that has a line lookup done on it; I've attempted to minimize this by using dynamic selection of integer sized when storing offset arrays. But the main motive here is to make-impossible the cases we don't always see, that show up by surprise when there is an out-of-order access pattern.
Reviewers: jordan_rose
Reviewed By: jordan_rose
Subscribers: probinson, llvm-commits
Differential Revision: https://reviews.llvm.org/D45003
llvm-svn: 329470
show more ...
|
Revision tags: llvmorg-5.0.2, llvmorg-5.0.2-rc2, llvmorg-5.0.2-rc1, llvmorg-6.0.0, llvmorg-6.0.0-rc3, llvmorg-6.0.0-rc2, llvmorg-6.0.0-rc1, llvmorg-5.0.1, llvmorg-5.0.1-rc3, llvmorg-5.0.1-rc2, llvmorg-5.0.1-rc1 |
|
#
01104aee |
| 12-Oct-2017 |
Adam Nemet <anemet@apple.com> |
Add DK_Remark to SMDiagnostic
Swift uses SMDiagnostic for diagnostic messages. For https://github.com/apple/swift/pull/12294, we need remark support.
I picked the color that clang uses to display t
Add DK_Remark to SMDiagnostic
Swift uses SMDiagnostic for diagnostic messages. For https://github.com/apple/swift/pull/12294, we need remark support.
I picked the color that clang uses to display them.
Differential Revision: https://reviews.llvm.org/D38865
llvm-svn: 315642
show more ...
|
Revision tags: llvmorg-5.0.0, llvmorg-5.0.0-rc5, llvmorg-5.0.0-rc4, llvmorg-5.0.0-rc3, llvmorg-5.0.0-rc2, llvmorg-5.0.0-rc1, llvmorg-4.0.1, llvmorg-4.0.1-rc3 |
|
#
6bda14b3 |
| 06-Jun-2017 |
Chandler Carruth <chandlerc@gmail.com> |
Sort the remaining #include lines in include/... and lib/....
I did this a long time ago with a janky python script, but now clang-format has built-in support for this. I fed clang-format every line
Sort the remaining #include lines in include/... and lib/....
I did this a long time ago with a janky python script, but now clang-format has built-in support for this. I fed clang-format every line with a #include and let it re-sort things according to the precise LLVM rules for include ordering baked into clang-format these days.
I've reverted a number of files where the results of sorting includes isn't healthy. Either places where we have legacy code relying on particular include ordering (where possible, I'll fix these separately) or where we have particular formatting around #include lines that I didn't want to disturb in this patch.
This patch is *entirely* mechanical. If you get merge conflicts or anything, just ignore the changes in this patch and run clang-format over your #include lines in the files.
Sorry for any noise here, but it is important to keep these things stable. I was seeing an increasing number of patches with irrelevant re-ordering of #include lines because clang-format was used. This patch at least isolates that churn, makes it easy to skip when resolving conflicts, and gets us to a clean baseline (again).
llvm-svn: 304787
show more ...
|
Revision tags: llvmorg-4.0.1-rc2 |
|
#
43b72d53 |
| 01-May-2017 |
Gabor Horvath <xazax.hun@gmail.com> |
Remove unnecessary conditions as suggested by clang-tidy. NFC
Patch by: Gergely Angeli!
Differential Revision: https://reviews.llvm.org/D31936
llvm-svn: 301807
|
Revision tags: llvmorg-4.0.1-rc1, llvmorg-4.0.0, llvmorg-4.0.0-rc4, llvmorg-4.0.0-rc3 |
|
#
454d0cea |
| 15-Feb-2017 |
Eugene Zelenko <eugene.zelenko@gmail.com> |
[Support] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 295243
|
Revision tags: llvmorg-4.0.0-rc2, llvmorg-4.0.0-rc1, llvmorg-3.9.1, llvmorg-3.9.1-rc3, llvmorg-3.9.1-rc2, llvmorg-3.9.1-rc1 |
|
#
99d1b295 |
| 01-Oct-2016 |
Mehdi Amini <mehdi.amini@apple.com> |
Use StringRef for MemoryBuffer identifier API (NFC)
llvm-svn: 283043
|
Revision tags: llvmorg-3.9.0, llvmorg-3.9.0-rc3, llvmorg-3.9.0-rc2 |
|
#
0464ae83 |
| 16-Aug-2016 |
Benjamin Kramer <benny.kra@googlemail.com> |
Remove excessive padding from LineNoCacheTy
The struct LineNoCacheTy is in SourceMgr.cpp inside anonymous namespace. This diff changes the order of fields and removes the excessive padding (8 bytes)
Remove excessive padding from LineNoCacheTy
The struct LineNoCacheTy is in SourceMgr.cpp inside anonymous namespace. This diff changes the order of fields and removes the excessive padding (8 bytes).
Patch by Alexander Shaposhnikov!
Differential revision: https://reviews.llvm.org/D23546
llvm-svn: 278838
show more ...
|
#
562e8294 |
| 12-Aug-2016 |
David Majnemer <david.majnemer@gmail.com> |
Use the range variant of find_if instead of unpacking begin/end
No functionality change is intended.
llvm-svn: 278443
|
Revision tags: llvmorg-3.9.0-rc1, llvmorg-3.8.1, llvmorg-3.8.1-rc1, llvmorg-3.8.0, llvmorg-3.8.0-rc3, llvmorg-3.8.0-rc2, llvmorg-3.8.0-rc1, llvmorg-3.7.1, llvmorg-3.7.1-rc2, llvmorg-3.7.1-rc1, llvmorg-3.7.0, llvmorg-3.7.0-rc4, llvmorg-3.7.0-rc3, studio-1.4, llvmorg-3.7.0-rc2, llvmorg-3.7.0-rc1, llvmorg-3.6.2, llvmorg-3.6.2-rc1 |
|
#
735c47ec |
| 15-Jun-2015 |
Alex Lorenz <arphaman@gmail.com> |
MIR Serialization: Connect the machine function analysis pass to the MIR parser.
This commit connects the machine function analysis pass (which creates machine functions) to the MIR parser, which wi
MIR Serialization: Connect the machine function analysis pass to the MIR parser.
This commit connects the machine function analysis pass (which creates machine functions) to the MIR parser, which will initialize the machine functions with the state from the MIR file and reconstruct the machine IR.
This commit introduces a new interface called 'MachineFunctionInitializer', which can be used to provide custom initialization for the machine functions.
This commit also introduces a new diagnostic class called 'DiagnosticInfoMIRParser' which is used for MIR parsing errors. This commit modifies the default diagnostic handling in LLVMContext - now the the diagnostics are printed directly into llvm::errs() so that the MIR parsing errors can be printed with colours.
Reviewers: Justin Bogner
Differential Revision: http://reviews.llvm.org/D9928
llvm-svn: 239753
show more ...
|
Revision tags: llvmorg-3.6.1, llvmorg-3.6.1-rc1 |
|
#
16132e6f |
| 23-Mar-2015 |
Benjamin Kramer <benny.kra@googlemail.com> |
Purge unused includes throughout libSupport.
NFC.
llvm-svn: 232976
|
Revision tags: llvmorg-3.5.2, llvmorg-3.5.2-rc1, llvmorg-3.6.0, llvmorg-3.6.0-rc4, llvmorg-3.6.0-rc3, llvmorg-3.6.0-rc2, llvmorg-3.6.0-rc1, llvmorg-3.5.1, llvmorg-3.5.1-rc2, llvmorg-3.5.1-rc1 |
|
#
6e863d12 |
| 06-Nov-2014 |
Matt Arsenault <Matthew.Arsenault@amd.com> |
Remove unnecessary .c_str() when implicitly converting to Twine
llvm-svn: 221422
|
Revision tags: llvmorg-3.5.0, llvmorg-3.5.0-rc4 |
|
#
1961f14c |
| 21-Aug-2014 |
David Blaikie <dblaikie@gmail.com> |
Explicitly pass ownership of the MemoryBuffer to AddNewSourceBuffer using std::unique_ptr
llvm-svn: 216223
|
Revision tags: llvmorg-3.5.0-rc3, llvmorg-3.5.0-rc2, llvmorg-3.5.0-rc1 |
|
#
a5b27a71 |
| 09-Jul-2014 |
Dmitri Gribenko <gribozavr@gmail.com> |
SourceMgr: consistently use 'unsigned' for the memory buffer ID type
llvm-svn: 212595
|
#
adf21f2a |
| 06-Jul-2014 |
Rafael Espindola <rafael.espindola@gmail.com> |
Update the MemoryBuffer API to use ErrorOr.
llvm-svn: 212405
|
#
a55b95b5 |
| 06-Jul-2014 |
Alp Toker <alp@nuanti.com> |
SourceMgr: make valid buffer IDs start from one
Use 0 for the invalid buffer instead of -1/~0 and switch to unsigned representation to enable more idiomatic usage.
Also introduce a trivial SourceMg
SourceMgr: make valid buffer IDs start from one
Use 0 for the invalid buffer instead of -1/~0 and switch to unsigned representation to enable more idiomatic usage.
Also introduce a trivial SourceMgr::getMainFileID() instead of hard-coding 0/1 to identify the main file.
llvm-svn: 212398
show more ...
|
#
7899d504 |
| 25-Jun-2014 |
Alp Toker <alp@nuanti.com> |
Use SourceMgr::getMemoryBuffer() in a couple of places
Cleanup only.
llvm-svn: 211656
|
#
57ffdb07 |
| 17-Jun-2014 |
Jordan Rose <jordan_rose@apple.com> |
Add an overload for SourceMgr::PrintMessage that takes an existing diagnostic.
llvm-svn: 211087
|
#
b4cfd007 |
| 17-Jun-2014 |
Jordan Rose <jordan_rose@apple.com> |
Modernize doc comments for SourceMgr.
No functionality change.
llvm-svn: 211086
|
#
a6e9c3e4 |
| 12-Jun-2014 |
Rafael Espindola <rafael.espindola@gmail.com> |
Remove system_error.h.
This is a minimal change to remove the header. I will remove the occurrences of "using std::error_code" in a followup patch.
llvm-svn: 210803
|
Revision tags: llvmorg-3.4.2, llvmorg-3.4.2-rc1 |
|
#
15217200 |
| 16-May-2014 |
Yaron Keren <yaron.keren@gmail.com> |
Fix hardcoded slash to native path seperator which was exposed from llvm::sys::path.
http://reviews.llvm.org/D3687
llvm-svn: 208980
|
Revision tags: llvmorg-3.4.1, llvmorg-3.4.1-rc2, llvmorg-3.4.1-rc1 |
|
#
8d399f87 |
| 09-Apr-2014 |
Craig Topper <craig.topper@gmail.com> |
[C++11] Replace some comparisons with 'nullptr' with simple boolean checks to reduce verbosity.
llvm-svn: 205829
|
#
c10719f5 |
| 07-Apr-2014 |
Craig Topper <craig.topper@gmail.com> |
[C++11] Make use of 'nullptr' in the Support library.
llvm-svn: 205697
|
#
56440fd8 |
| 06-Mar-2014 |
Ahmed Charles <ahmedcharles@gmail.com> |
Replace OwningPtr<T> with std::unique_ptr<T>.
This compiles with no changes to clang/lld/lldb with MSVC and includes overloads to various functions which are used by those projects and llvm which ha
Replace OwningPtr<T> with std::unique_ptr<T>.
This compiles with no changes to clang/lld/lldb with MSVC and includes overloads to various functions which are used by those projects and llvm which have OwningPtr's as parameters. This should allow out of tree projects some time to move. There are also no changes to libs/Target, which should help out of tree targets have time to move, if necessary.
llvm-svn: 203083
show more ...
|
#
96c9d95f |
| 05-Mar-2014 |
Ahmed Charles <ahmedcharles@gmail.com> |
[C++11] Replace OwningPtr::take() with OwningPtr::release().
llvm-svn: 202957
|
Revision tags: llvmorg-3.4.0, llvmorg-3.4.0-rc3, llvmorg-3.4.0-rc2, llvmorg-3.4.0-rc1 |
|
#
78fe2ba3 |
| 27-Sep-2013 |
Dmitri Gribenko <gribozavr@gmail.com> |
SourceMgr diagnotics printing: fix a bug where printing a fixit for a source range that includes a tab character will cause out-of-bounds access to the fixit string.
llvm-svn: 191563
|