Page MenuHomePhabricator

[RISCV] Lower build_vector of VID sequence with one inconsistent element to vid and insert_vector_elt.
Needs ReviewPublic

Authored by jacquesguan on Jun 8 2022, 2:23 AM.



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.

Diff Detail

Unit TestsFailed

60,140 msx64 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 msx64 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

Event Timeline

jacquesguan created this revision.Jun 8 2022, 2:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 8 2022, 2:23 AM
jacquesguan requested review of this revision.Jun 8 2022, 2:23 AM
reames added a subscriber: reames.Jun 8 2022, 7:52 AM
reames added inline comments.

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?

frasercrmck added inline comments.Jun 8 2022, 7:55 AM

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?