Revision 0d54ad3086b7fc61afa28b512b27668e1ddef2f5 authored by Keno Fischer on 17 April 2024, 23:01:19 UTC, committed by Keno Fischer on 17 April 2024, 23:40:48 UTC
The strategy here is to look at (data, padding) pairs and RLE
them into loops, so that repeated adjacent patterns use a loop
rather than getting unrolled. On the test case from #54109,
this makes compilation essentially instant, while also being
faster at runtime (turns out LLVM spends a massive amount of time
AND the answer is bad).

There's some obvious further enhancements possible here:
1. The `memcmp` constant is small. LLVM has a pass to inline these
   with better code. However, we don't have it turned on. We should
   consider vendoring it, though we may want to add some shorcutting
   to it to avoid having it iterate through each function.
2. This only does one level of sequence matching. It could be recursed
   to turn things into nested loops.

However, this solves the immediate issue, so hopefully it's a useful
start. Fixes #54109.
1 parent 7ba1b33
Raw File
.git-blame-ignore-revs
# .git-blame-ignore-revs
# whitespace: end text files with single newlines
3903fa54a638d4546ef50e56f91f0705a8ab11ef
# whitespace: use only UNIX line endings (\n)
e66bfa5dd32f93e76068c00ad882c1fc839c5af8
# whitespace: replace non-breaking space => space
100a741e7ab38c91d48cc929bb001afc8e09261f
# whitespace: replace tabs => space
b03e8ab9c7bd3e001add519571858fa04d6a249b
back to top