This patch supports to identify build_vector of the VID sequence with just one inconsistent element, and will lower it to vid and insert_vector_elt.
|60,140 ms||x64 debian > AddressSanitizer-x86_64-linux-dynamic.TestCases::scariness_score_test.cpp|
Script: -- : 'RUN: at line 4'; /var/lib/buildkite-agent/builds/llvm-project/build/./bin/clang --driver-mode=g++ -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only -m64 -shared-libasan -O0 /var/lib/buildkite-agent/builds/llvm-project/compiler-rt/test/asan/TestCases/scariness_score_test.cpp -o /var/lib/buildkite-agent/builds/llvm-project/build/projects/compiler-rt/test/asan/X86_64LinuxDynamicConfig/TestCases/Output/scariness_score_test.cpp.tmp
|60,100 ms||x64 debian > AddressSanitizer-x86_64-linux.TestCases::scariness_score_test.cpp|
Script: -- : 'RUN: at line 4'; /var/lib/buildkite-agent/builds/llvm-project/build/./bin/clang --driver-mode=g++ -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only -m64 -O0 /var/lib/buildkite-agent/builds/llvm-project/compiler-rt/test/asan/TestCases/scariness_score_test.cpp -o /var/lib/buildkite-agent/builds/llvm-project/build/projects/compiler-rt/test/asan/X86_64LinuxConfig/TestCases/Output/scariness_score_test.cpp.tmp
This is algorithmically slow.
You can achieve the same effect with a direct change to the matching code which allows it to fuzzy match exactly one element.
Doing so is non trivial, but once you find the first three non-undefs in the sequence it should be easy to distinguish.
Its not clear to me that a six instruction sequence is worthwhile to remove a constant pool entry. Can you make an argument as to why this change is worthwhile?
I agree. It seems unfortunate to pessimise almost all BUILD_VECTOR compile times just for this case. Does this really show up in real-world code often enough to warrant this optimization?
Do we really want to match a v256 build vector where only element 148 is out of sequence, for example?