llvm-project/llvm/utils
Chandler Carruth 726774cbf8 [FileCheck] Re-implement the logic to find each check prefix in the
check file to not be unreasonably slow in the face of multiple check
prefixes.

The previous logic would repeatedly scan potentially large portions of
the check file looking for alternative prefixes. In the worst case this
would scan most of the file looking for a rare prefix between every
single occurance of a common prefix. Even if we bounded the scan, this
would do bad things if the order of the prefixes was "unlucky" and the
distant prefix was scanned for first.

None of this is necessary. It is straightforward to build a state
machine that recognizes the first, longest of the set of alternative
prefixes. That is in fact exactly whan a regular expression does.

This patch builds a regular expression once for the set of prefixes and
then uses it to search incrementally for the next prefix. This requires
some threading of state but actually makes the code dramatically
simpler. I've also added a big comment describing the algorithm as it
was not at all obvious to me when I started.

With this patch, several previously pathological test cases in
test/CodeGen/X86 are 5x and more faster. Overall, running all tests
under test/CodeGen/X86 uses 10% less CPU after this, and because all the
slowest tests were hitting this, finishes in 40% less wall time on my
system (going from just over 5.38s to just over 3.23s) on a release
build! This patch substantially improves the time of all 7 X86 tests
that were in the top 20 reported by --time-tests, 5 of them are
completely off the list and the remaining 2 are much lower. (Sadly, the
new tests on the list include 2 new X86 ones that are slow for unrelated
reasons, so the count stays at 4 of the top 20.)

It isn't clear how much this helps debug builds in aggregate in part
because of the noise, but it again makes mane of the slowest x86 tests
significantly faster (10% or more improvement).

llvm-svn: 289382
2016-12-11 12:49:05 +00:00
..
FileCheck [FileCheck] Re-implement the logic to find each check prefix in the 2016-12-11 12:49:05 +00:00
KillTheDoctor Explicitly specify the ANSI version of these Win32 APIs. While these are seemingly unrelated changes, they are all NFC because we currently default to the ANSI versions of the APIs when building for Windows. This simply makes the ANSI usage explicit. 2016-06-23 14:45:54 +00:00
LLVMVisualizers Improved Visual Studio 2015 visualization of SmallVectorImpl 2016-06-13 01:43:14 +00:00
Misc Delete mergefunctions.clang.svn.patch 2016-04-12 19:44:40 +00:00
PerfectShuffle
TableGen [AMDGPU, PowerPC, TableGen] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2016-12-09 22:06:55 +00:00
Target/ARM
abtest abtest: Cleanup, improve comments 2016-03-26 04:07:55 +00:00
bugpoint
count
crosstool
emacs
fpcmp
gdb-scripts Fix gdb pretty printers to work with Python 3. 2016-08-05 16:48:31 +00:00
git
git-svn [git-llvm] Use --force-interactive when commiting to enable SVN to prompt password 2016-11-30 19:12:53 +00:00
jedit
kate
lint
lit [lit] Support custom parsers in parseIntegratedTestScript 2016-12-05 20:21:21 +00:00
llvm-build
llvm-lit Fix llvm-lit.in corresponding to r283710. 2016-10-10 23:02:42 +00:00
not Remove unused header, NFC. 2016-12-01 19:38:48 +00:00
opt-viewer [opt-viewer] Add support for libYAML for faster parsing 2016-11-15 08:40:51 +00:00
release Print correct directory in merge script. 2016-11-11 23:26:28 +00:00
testgen
textmate
unittest [cmake] Export gtest/gtest_main and its dependencies via a special build tree only cmake exports file. 2016-09-09 19:45:34 +00:00
valgrind
vim vim: special case the CHECK prefix 2016-11-03 15:56:06 +00:00
yaml-bench Timer: Track name and description. 2016-11-18 19:43:18 +00:00
DSAclean.py
DSAextract.py
GenLibDeps.pl Remove bit-rotten CppBackend. 2016-05-05 14:35:40 +00:00
GetRepositoryPath
GetSourceVersion
LLVMBuild.txt
UpdateCMakeLists.pl
bisect
check-each-file
clang-parse-diagnostics-file
codegen-diff
countloc.sh
create_ladder_graph.py
extract_symbols.py Handle non-inlined clang::Type::getAs specializations in extract_symbols.py 2016-11-14 17:07:09 +00:00
findmisopt
findoptdiff Remove the ScalarReplAggregates pass 2016-06-15 00:19:09 +00:00
findsym.pl
getsrcs.sh
lldbDataFormatters.py
llvm-compilers-check
llvm-native-gxx
llvm.grm
llvmdo
llvmgrep
makellvm
prepare-code-coverage-artifact.py [utils] Add a '--unified-report' option to the code coverage prep script 2016-10-26 22:07:39 +00:00
schedcover.py
shuffle_fuzz.py
sort_includes.py
test_debuginfo.pl
update_llc_test_checks.py [X86] Fix test checks script to satisfy pyflakes 2016-11-07 18:08:19 +00:00
update_test_checks.py [X86][AVX512] Add support for masked shuffle comments 2016-07-03 13:08:29 +00:00
wciia.py