From 3670d2ef78fea4d7d5701092648022a21b977c16 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Wed, 26 Apr 2017 22:45:04 +0000 Subject: [PATCH] Replace HashString algorithm with xxHash64 The previous algorithm processed one character at a time, which is very painful on a modern CPU. Replace it with xxHash64, which both already exists in the codebase and is fairly fast. Patch from Scott Smith! Differential Revision: https://reviews.llvm.org/D32509 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301487 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CodeGen/target-features-error-2.c | 9 ++++++--- test/CodeGen/target-features-error.c | 3 +-- test/SemaCXX/typo-correction-delayed.cpp | 7 ++++++- unittests/Tooling/CompilationDatabaseTest.cpp | 4 ++-- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/test/CodeGen/target-features-error-2.c b/test/CodeGen/target-features-error-2.c index 683d9ab99e..9ce829a48c 100644 --- a/test/CodeGen/target-features-error-2.c +++ b/test/CodeGen/target-features-error-2.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -S -verify -o - -D NEED_SSE42 +// RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -S -verify -o - -D NEED_SSE41 // RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -S -verify -o - -D NEED_AVX_1 // RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -S -verify -o - -D NEED_AVX_2 // RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -S -verify -o - -D NEED_AVX_3 @@ -7,9 +7,12 @@ #define __MM_MALLOC_H #include -#if NEED_SSE42 +// Really, this needs AVX, but because targetting AVX includes all the SSE features too, and +// features are sorted by hash function, and we just return the first missing feature, then we end +// up returning the subfeature sse4.1 instead of avx. +#if NEED_SSE41 int baz(__m256i a) { - return _mm256_extract_epi32(a, 3); // expected-error {{always_inline function '_mm256_extract_epi32' requires target feature 'sse4.2', but would be inlined into function 'baz' that is compiled without support for 'sse4.2'}} + return _mm256_extract_epi32(a, 3); // expected-error {{always_inline function '_mm256_extract_epi32' requires target feature 'sse4.1', but would be inlined into function 'baz' that is compiled without support for 'sse4.1'}} } #endif diff --git a/test/CodeGen/target-features-error.c b/test/CodeGen/target-features-error.c index 518f6e6189..d4deabd66b 100644 --- a/test/CodeGen/target-features-error.c +++ b/test/CodeGen/target-features-error.c @@ -3,6 +3,5 @@ int __attribute__((target("avx"), always_inline)) foo(int a) { return a + 4; } int bar() { - return foo(4); // expected-error {{always_inline function 'foo' requires target feature 'sse4.2', but would be inlined into function 'bar' that is compiled without support for 'sse4.2'}} + return foo(4); // expected-error {{always_inline function 'foo' requires target feature 'sse4.1', but would be inlined into function 'bar' that is compiled without support for 'sse4.1'}} } - diff --git a/test/SemaCXX/typo-correction-delayed.cpp b/test/SemaCXX/typo-correction-delayed.cpp index 610d439713..11d54006f3 100644 --- a/test/SemaCXX/typo-correction-delayed.cpp +++ b/test/SemaCXX/typo-correction-delayed.cpp @@ -52,6 +52,7 @@ void testNoCandidates() { } class string {}; + struct Item { void Nest(); string text(); @@ -88,12 +89,16 @@ void f(LinkedNode *node) { struct NestedNode { NestedNode* Nest(); NestedNode* next(); - string text() const; + // Note, this test is dependent on the order in which identifiers are passed + // to the typo corrector, which is based on the hash function used. For + // consistency, I am making the next keyword the first identifier returned. + string eext() const; }; void f(NestedNode *node) { // There are two equidistant, usable corrections for Next: next and Nest NestedNode *next = node->Next(); // expected-error-re {{no member named 'Next' in 'initializerCorrections::NestedNode'{{$}}}} } + } namespace PR21669 { diff --git a/unittests/Tooling/CompilationDatabaseTest.cpp b/unittests/Tooling/CompilationDatabaseTest.cpp index 1a6fffec93..5d4ed20603 100644 --- a/unittests/Tooling/CompilationDatabaseTest.cpp +++ b/unittests/Tooling/CompilationDatabaseTest.cpp @@ -81,10 +81,10 @@ TEST(JSONCompilationDatabase, GetAllFiles) { std::vector expected_files; SmallString<16> PathStorage; - llvm::sys::path::native("//net/dir/file1", PathStorage); - expected_files.push_back(PathStorage.str()); llvm::sys::path::native("//net/dir/file2", PathStorage); expected_files.push_back(PathStorage.str()); + llvm::sys::path::native("//net/dir/file1", PathStorage); + expected_files.push_back(PathStorage.str()); EXPECT_EQ(expected_files, getAllFiles("[{\"directory\":\"//net/dir\"," "\"command\":\"command\"," -- 2.40.0