forked from OSchip/llvm-project
726774cbf8
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 |
||
---|---|---|
.. | ||
FileCheck | ||
KillTheDoctor | ||
LLVMVisualizers | ||
Misc | ||
PerfectShuffle | ||
TableGen | ||
Target/ARM | ||
abtest | ||
bugpoint | ||
count | ||
crosstool | ||
emacs | ||
fpcmp | ||
gdb-scripts | ||
git | ||
git-svn | ||
jedit | ||
kate | ||
lint | ||
lit | ||
llvm-build | ||
llvm-lit | ||
not | ||
opt-viewer | ||
release | ||
testgen | ||
textmate | ||
unittest | ||
valgrind | ||
vim | ||
yaml-bench | ||
DSAclean.py | ||
DSAextract.py | ||
GenLibDeps.pl | ||
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 | ||
findmisopt | ||
findoptdiff | ||
findsym.pl | ||
getsrcs.sh | ||
lldbDataFormatters.py | ||
llvm-compilers-check | ||
llvm-native-gxx | ||
llvm.grm | ||
llvmdo | ||
llvmgrep | ||
makellvm | ||
prepare-code-coverage-artifact.py | ||
schedcover.py | ||
shuffle_fuzz.py | ||
sort_includes.py | ||
test_debuginfo.pl | ||
update_llc_test_checks.py | ||
update_test_checks.py | ||
wciia.py |