[llvm-branch-commits] [libcxx] f1b1151 - [libc++] [test] Fix a few tests for 32-bit x86
Tom Stellard via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Jun 4 20:32:29 PDT 2021
Author: Harald van Dijk
Date: 2021-06-04T20:31:25-07:00
New Revision: f1b1151b61b19391b083ced5d4b0b710ada07f6c
URL: https://github.com/llvm/llvm-project/commit/f1b1151b61b19391b083ced5d4b0b710ada07f6c
DIFF: https://github.com/llvm/llvm-project/commit/f1b1151b61b19391b083ced5d4b0b710ada07f6c.diff
LOG: [libc++] [test] Fix a few tests for 32-bit x86
Fixes bug https://llvm.org/PR48939.
Differential Revision: https://reviews.llvm.org/D102359
(cherry picked from commit 73cdc7599bf053c3e22ce6bb15a4266f66bd5e69)
Added:
Modified:
libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp
libcxx/test/libcxx/memory/trivial_abi/unique_ptr_ret.pass.cpp
libcxx/test/libcxx/memory/trivial_abi/weak_ptr_ret.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp b/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp
index fed6a1618483..cf560ce31097 100644
--- a/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp
+++ b/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp
@@ -427,9 +427,9 @@ void multiset_test() {
void vector_test() {
std::vector<bool> test0 = {true, false};
- ComparePrettyPrintToChars(test0,
+ ComparePrettyPrintToRegex(test0,
"std::vector<bool> of "
- "length 2, capacity 64 = {1, 0}");
+ "length 2, capacity (32|64) = {1, 0}");
for (int i = 0; i < 31; ++i) {
test0.push_back(true);
test0.push_back(false);
@@ -444,9 +444,9 @@ void vector_test() {
ComparePrettyPrintToRegex(
test0,
"std::vector<bool> of length 65, "
- "capacity 128 = {1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, "
- "1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, "
- "1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1}");
+ "capacity (96|128) = {1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, "
+ "0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, "
+ "0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1}");
std::vector<int> test1;
ComparePrettyPrintToChars(test1, "std::vector of length 0, capacity 0");
diff --git a/libcxx/test/libcxx/memory/trivial_abi/unique_ptr_ret.pass.cpp b/libcxx/test/libcxx/memory/trivial_abi/unique_ptr_ret.pass.cpp
index 73fe18becc3a..5cda71371fa6 100644
--- a/libcxx/test/libcxx/memory/trivial_abi/unique_ptr_ret.pass.cpp
+++ b/libcxx/test/libcxx/memory/trivial_abi/unique_ptr_ret.pass.cpp
@@ -46,7 +46,11 @@ int main(int, char**) {
//
// With trivial_abi, local_addr is the address of a local variable in
// make_val, and hence
diff erent from &ret.
+#if !defined(__i386__)
+ // On X86, structs are never returned in registers.
+ // Thus, unique_ptr will be passed indirectly even if it is trivial.
assert((void*)&ret != local_addr);
+#endif
return 0;
}
diff --git a/libcxx/test/libcxx/memory/trivial_abi/weak_ptr_ret.pass.cpp b/libcxx/test/libcxx/memory/trivial_abi/weak_ptr_ret.pass.cpp
index e69c94506f2a..9b4e95e249e2 100644
--- a/libcxx/test/libcxx/memory/trivial_abi/weak_ptr_ret.pass.cpp
+++ b/libcxx/test/libcxx/memory/trivial_abi/weak_ptr_ret.pass.cpp
@@ -49,9 +49,10 @@ int main(int, char**) {
//
// With trivial_abi, local_addr is the address of a local variable in
// make_val, and hence
diff erent from &ret.
-#ifndef __arm__
+#if !defined(__i386__) && !defined(__arm__)
+ // On X86, structs are never returned in registers.
// On ARM32, structs larger than 4 bytes cannot be returned in registers.
- // Thus, weak_ptr will be passed indrectly even if it is trivial.
+ // Thus, weak_ptr will be passed indirectly even if it is trivial.
assert((void*)&ret != local_addr);
#endif
return 0;
More information about the llvm-branch-commits
mailing list