aboutsummaryrefslogtreecommitdiff
path: root/test/msan
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-09-06 18:41:23 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-09-06 18:41:23 +0000
commitf31bcc68c72371a2bf63aead9f3373a1ff2053b6 (patch)
treeb259e5d585da0f8cde9579939a74d5ef44c72abd /test/msan
parentcd2dd3df15523e2be8d2bbace27641d6ac9fa40d (diff)
downloadsrc-f31bcc68c72371a2bf63aead9f3373a1ff2053b6.tar.gz
src-f31bcc68c72371a2bf63aead9f3373a1ff2053b6.zip
Import compiler-rt 3.7.0 release (r246257).vendor/compiler-rt/compiler-rt-release_370-r246257
Notes
Notes: svn path=/vendor/compiler-rt/dist/; revision=287516 svn path=/vendor/compiler-rt/compiler-rt-release_370-r246257/; revision=287517; tag=vendor/compiler-rt/compiler-rt-release_370-r246257
Diffstat (limited to 'test/msan')
-rw-r--r--test/msan/Linux/fopencookie.cc65
-rw-r--r--test/msan/Linux/getresid.cc6
-rw-r--r--test/msan/Linux/glob.cc6
-rw-r--r--test/msan/Linux/glob_altdirfunc.cc6
-rw-r--r--test/msan/Linux/glob_nomatch.cc4
-rw-r--r--test/msan/Linux/ioctl_sound.cc (renamed from test/msan/ioctl_sound.cc)4
-rw-r--r--test/msan/Linux/mallinfo.cc (renamed from test/msan/mallinfo.cc)2
-rw-r--r--test/msan/Linux/obstack.cc (renamed from test/msan/obstack.cc)4
-rw-r--r--test/msan/Linux/sunrpc.cc12
-rw-r--r--test/msan/Linux/sunrpc_bytes.cc4
-rw-r--r--test/msan/Linux/sunrpc_string.cc4
-rw-r--r--test/msan/Linux/syscalls.cc4
-rw-r--r--test/msan/Linux/tcgetattr.cc2
-rw-r--r--test/msan/Linux/xattr.cc6
-rw-r--r--test/msan/backtrace.cc4
-rw-r--r--test/msan/c-strdup.c8
-rw-r--r--test/msan/chained_origin.cc8
-rw-r--r--test/msan/chained_origin_empty_stack.cc2
-rw-r--r--test/msan/chained_origin_limits.cc8
-rw-r--r--test/msan/chained_origin_memcpy.cc8
-rw-r--r--test/msan/chained_origin_with_signals.cc4
-rw-r--r--test/msan/check_mem_is_initialized.cc16
-rw-r--r--test/msan/coverage-levels.cc8
-rw-r--r--test/msan/cxa_atexit.cc2
-rw-r--r--test/msan/death-callback.cc8
-rw-r--r--test/msan/dlerror.cc2
-rw-r--r--test/msan/dso-origin.cc4
-rw-r--r--test/msan/dtls_test.c4
-rw-r--r--test/msan/errno.cc2
-rw-r--r--test/msan/fork.cc2
-rw-r--r--test/msan/ftime.cc5
-rw-r--r--test/msan/getaddrinfo-positive.cc4
-rw-r--r--test/msan/getaddrinfo.cc2
-rw-r--r--test/msan/getc_unlocked.c16
-rw-r--r--test/msan/getline.cc4
-rw-r--r--test/msan/heap-origin.cc16
-rw-r--r--test/msan/iconv.cc9
-rw-r--r--test/msan/if_indextoname.cc8
-rw-r--r--test/msan/ifaddrs.cc10
-rw-r--r--test/msan/initgroups.cc3
-rw-r--r--test/msan/insertvalue_origin.cc4
-rw-r--r--test/msan/ioctl.cc4
-rw-r--r--test/msan/ioctl_custom.cc8
-rw-r--r--test/msan/keep-going-dso.cc12
-rw-r--r--test/msan/keep-going.cc16
-rw-r--r--test/msan/lit.cfg3
-rw-r--r--test/msan/mktime.cc4
-rw-r--r--test/msan/mmap.cc45
-rw-r--r--test/msan/mmap_below_shadow.cc16
-rw-r--r--test/msan/msan_check_mem_is_initialized.cc4
-rw-r--r--test/msan/msan_dump_shadow.cc6
-rw-r--r--test/msan/msan_print_shadow.cc6
-rw-r--r--test/msan/msan_print_shadow2.cc6
-rw-r--r--test/msan/msan_print_shadow3.cc2
-rw-r--r--test/msan/mul_by_const.cc2
-rw-r--r--test/msan/no_sanitize_memory.cc16
-rw-r--r--test/msan/no_sanitize_memory_prop.cc8
-rw-r--r--test/msan/origin-store-long.cc4
-rw-r--r--test/msan/param_tls_limit.cc6
-rw-r--r--test/msan/print_stats.cc6
-rw-r--r--test/msan/pthread_getattr_np_deadlock.cc2
-rw-r--r--test/msan/rand_r.cc4
-rw-r--r--test/msan/readdir64.cc16
-rw-r--r--test/msan/realloc-large-origin.cc4
-rw-r--r--test/msan/realloc-origin.cc4
-rw-r--r--test/msan/report-demangling.cc4
-rw-r--r--test/msan/scandir.cc6
-rw-r--r--test/msan/scandir_null.cc6
-rw-r--r--test/msan/select.cc8
-rw-r--r--test/msan/setlocale.cc2
-rw-r--r--test/msan/stack-origin.cc16
-rw-r--r--test/msan/stack-origin2.cc16
-rw-r--r--test/msan/strlen_of_shadow.cc6
-rw-r--r--test/msan/strxfrm.cc2
-rw-r--r--test/msan/sync_lock_set_and_test.cc2
-rw-r--r--test/msan/textdomain.cc2
-rw-r--r--test/msan/times.cc2
-rw-r--r--test/msan/tls_reuse.cc2
-rw-r--r--test/msan/tzset.cc2
-rw-r--r--test/msan/unaligned_read_origin.cc4
-rw-r--r--test/msan/unpoison_string.cc4
-rw-r--r--test/msan/use-after-free.cc16
-rw-r--r--test/msan/vector_cvt.cc5
-rw-r--r--test/msan/vector_select.cc6
84 files changed, 378 insertions, 237 deletions
diff --git a/test/msan/Linux/fopencookie.cc b/test/msan/Linux/fopencookie.cc
new file mode 100644
index 000000000000..e5b8f936e0d2
--- /dev/null
+++ b/test/msan/Linux/fopencookie.cc
@@ -0,0 +1,65 @@
+// Test fopencookie interceptor.
+// RUN: %clangxx_msan -std=c++11 -O0 %s -o %t && %run %t
+// RUN: %clangxx_msan -std=c++11 -fsanitize-memory-track-origins -O0 %s -o %t && %run %t
+
+#include <assert.h>
+#include <pthread.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <sanitizer/msan_interface.h>
+
+constexpr uintptr_t kMagicCookie = 0x12345678;
+
+static ssize_t cookie_read(void *cookie, char *buf, size_t size) {
+ assert((uintptr_t)cookie == kMagicCookie);
+ memset(buf, 0, size);
+ return 0;
+}
+
+static ssize_t cookie_write(void *cookie, const char *buf, size_t size) {
+ assert((uintptr_t)cookie == kMagicCookie);
+ __msan_check_mem_is_initialized(buf, size);
+ return 0;
+}
+
+static int cookie_seek(void *cookie, off64_t *offset, int whence) {
+ assert((uintptr_t)cookie == kMagicCookie);
+ __msan_check_mem_is_initialized(offset, sizeof(*offset));
+ return 0;
+}
+
+static int cookie_close(void *cookie) {
+ assert((uintptr_t)cookie == kMagicCookie);
+ return 0;
+}
+
+void PoisonStack() { char a[8192]; }
+
+void TestPoisonStack() {
+ // Verify that PoisonStack has poisoned the stack - otherwise this test is not
+ // testing anything.
+ char a;
+ assert(__msan_test_shadow(&a - 1000, 1) == 0);
+}
+
+int main() {
+ void *cookie = (void *)kMagicCookie;
+ FILE *f = fopencookie(cookie, "rw",
+ {cookie_read, cookie_write, cookie_seek, cookie_close});
+ PoisonStack();
+ TestPoisonStack();
+ fseek(f, 100, SEEK_SET);
+ char buf[50];
+ fread(buf, 50, 1, f);
+ fwrite(buf, 50, 1, f);
+ fclose(f);
+
+ f = fopencookie(cookie, "rw", {nullptr, nullptr, nullptr, nullptr});
+ fseek(f, 100, SEEK_SET);
+ fread(buf, 50, 1, f);
+ fwrite(buf, 50, 1, f);
+ fclose(f);
+}
diff --git a/test/msan/Linux/getresid.cc b/test/msan/Linux/getresid.cc
index 385351dfdcde..f3c0914b52f5 100644
--- a/test/msan/Linux/getresid.cc
+++ b/test/msan/Linux/getresid.cc
@@ -1,6 +1,6 @@
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && %run %t %p 2>&1
-// RUN: %clangxx_msan -m64 -O0 -D_FILE_OFFSET_BITS=64 %s -o %t && %run %t %p 2>&1
-// RUN: %clangxx_msan -m64 -O3 %s -o %t && %run %t %p 2>&1
+// RUN: %clangxx_msan -O0 %s -o %t && %run %t %p 2>&1
+// RUN: %clangxx_msan -O0 -D_FILE_OFFSET_BITS=64 %s -o %t && %run %t %p 2>&1
+// RUN: %clangxx_msan -O3 %s -o %t && %run %t %p 2>&1
#include <assert.h>
#include <unistd.h>
diff --git a/test/msan/Linux/glob.cc b/test/msan/Linux/glob.cc
index 8604e4d76265..1481861a08e0 100644
--- a/test/msan/Linux/glob.cc
+++ b/test/msan/Linux/glob.cc
@@ -1,6 +1,6 @@
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && %run %t %p 2>&1 | FileCheck %s
-// RUN: %clangxx_msan -m64 -O0 -D_FILE_OFFSET_BITS=64 %s -o %t && %run %t %p 2>&1 | FileCheck %s
-// RUN: %clangxx_msan -m64 -O3 %s -o %t && %run %t %p 2>&1 | FileCheck %s
+// RUN: %clangxx_msan -O0 %s -o %t && %run %t %p 2>&1 | FileCheck %s
+// RUN: %clangxx_msan -O0 -D_FILE_OFFSET_BITS=64 %s -o %t && %run %t %p 2>&1 | FileCheck %s
+// RUN: %clangxx_msan -O3 %s -o %t && %run %t %p 2>&1 | FileCheck %s
#include <assert.h>
#include <glob.h>
diff --git a/test/msan/Linux/glob_altdirfunc.cc b/test/msan/Linux/glob_altdirfunc.cc
index 2c02e735e05e..cb7fe09cbc3d 100644
--- a/test/msan/Linux/glob_altdirfunc.cc
+++ b/test/msan/Linux/glob_altdirfunc.cc
@@ -1,6 +1,6 @@
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && %run %t %p 2>&1 | FileCheck %s
-// RUN: %clangxx_msan -m64 -O0 -D_FILE_OFFSET_BITS=64 %s -o %t && %run %t %p 2>&1 | FileCheck %s
-// RUN: %clangxx_msan -m64 -O3 %s -o %t && %run %t %p 2>&1 | FileCheck %s
+// RUN: %clangxx_msan -O0 %s -o %t && %run %t %p 2>&1 | FileCheck %s
+// RUN: %clangxx_msan -O0 -D_FILE_OFFSET_BITS=64 %s -o %t && %run %t %p 2>&1 | FileCheck %s
+// RUN: %clangxx_msan -O3 %s -o %t && %run %t %p 2>&1 | FileCheck %s
#include <assert.h>
#include <glob.h>
diff --git a/test/msan/Linux/glob_nomatch.cc b/test/msan/Linux/glob_nomatch.cc
index bc35c30d6d07..fa132c813727 100644
--- a/test/msan/Linux/glob_nomatch.cc
+++ b/test/msan/Linux/glob_nomatch.cc
@@ -1,5 +1,5 @@
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && %run %t %p
-// RUN: %clangxx_msan -m64 -O3 %s -o %t && %run %t %p
+// RUN: %clangxx_msan -O0 %s -o %t && %run %t %p
+// RUN: %clangxx_msan -O3 %s -o %t && %run %t %p
#include <assert.h>
#include <glob.h>
diff --git a/test/msan/ioctl_sound.cc b/test/msan/Linux/ioctl_sound.cc
index ed896f761181..fb36c52f2e7e 100644
--- a/test/msan/ioctl_sound.cc
+++ b/test/msan/Linux/ioctl_sound.cc
@@ -1,5 +1,5 @@
-// RUN: %clangxx_msan -m64 -O0 -g %s -o %t && %run %t
-// RUN: %clangxx_msan -m64 -O3 -g %s -o %t && %run %t
+// RUN: %clangxx_msan -O0 -g %s -o %t && %run %t
+// RUN: %clangxx_msan -O3 -g %s -o %t && %run %t
#include <assert.h>
#include <fcntl.h>
diff --git a/test/msan/mallinfo.cc b/test/msan/Linux/mallinfo.cc
index 3f308683077e..3c3692969852 100644
--- a/test/msan/mallinfo.cc
+++ b/test/msan/Linux/mallinfo.cc
@@ -1,4 +1,4 @@
-// RUN: %clangxx_msan -m64 -O0 -g %s -o %t && %run %t
+// RUN: %clangxx_msan -O0 -g %s -o %t && %run %t
#include <assert.h>
#include <malloc.h>
diff --git a/test/msan/obstack.cc b/test/msan/Linux/obstack.cc
index 222f43b839dc..f1f53be4c9b2 100644
--- a/test/msan/obstack.cc
+++ b/test/msan/Linux/obstack.cc
@@ -1,5 +1,5 @@
-// RUN: %clangxx_msan -m64 -O0 -g %s -o %t && %run %t
-// RUN: %clangxx_msan -m64 -O0 -g -DPOSITIVE %s -o %t && not %run %t |& FileCheck %s
+// RUN: %clangxx_msan -O0 -g %s -o %t && %run %t
+// RUN: %clangxx_msan -O0 -g -DPOSITIVE %s -o %t && not %run %t |& FileCheck %s
#include <obstack.h>
#include <sanitizer/msan_interface.h>
diff --git a/test/msan/Linux/sunrpc.cc b/test/msan/Linux/sunrpc.cc
index 78645a7dcbf2..c92ad632c095 100644
--- a/test/msan/Linux/sunrpc.cc
+++ b/test/msan/Linux/sunrpc.cc
@@ -1,14 +1,14 @@
-// RUN: %clangxx_msan -m64 -g -O0 -DTYPE=int -DFN=xdr_int %s -o %t && \
+// RUN: %clangxx_msan -g -O0 -DTYPE=int -DFN=xdr_int %s -o %t && \
// RUN: %run %t 2>&1
-// RUN: %clangxx_msan -m64 -g -O0 -DTYPE=int -DFN=xdr_int -DUNINIT=1 %s -o %t && \
+// RUN: %clangxx_msan -g -O0 -DTYPE=int -DFN=xdr_int -DUNINIT=1 %s -o %t && \
// RUN: not %run %t 2>&1 | FileCheck %s
-// RUN: %clangxx_msan -m64 -g -O0 -DTYPE=double -DFN=xdr_double %s -o %t && \
+// RUN: %clangxx_msan -g -O0 -DTYPE=double -DFN=xdr_double %s -o %t && \
// RUN: %run %t 2>&1
-// RUN: %clangxx_msan -m64 -g -O0 -DTYPE=double -DFN=xdr_double -DUNINIT=1 %s -o %t && \
+// RUN: %clangxx_msan -g -O0 -DTYPE=double -DFN=xdr_double -DUNINIT=1 %s -o %t && \
// RUN: not %run %t 2>&1 | FileCheck %s
-// RUN: %clangxx_msan -m64 -g -O0 -DTYPE=u_quad_t -DFN=xdr_u_longlong_t %s -o %t && \
+// RUN: %clangxx_msan -g -O0 -DTYPE=u_quad_t -DFN=xdr_u_longlong_t %s -o %t && \
// RUN: %run %t 2>&1
-// RUN: %clangxx_msan -m64 -g -O0 -DTYPE=u_quad_t -DFN=xdr_u_longlong_t -DUNINIT=1 %s -o %t && \
+// RUN: %clangxx_msan -g -O0 -DTYPE=u_quad_t -DFN=xdr_u_longlong_t -DUNINIT=1 %s -o %t && \
// RUN: not %run %t 2>&1 | FileCheck %s
#include <assert.h>
diff --git a/test/msan/Linux/sunrpc_bytes.cc b/test/msan/Linux/sunrpc_bytes.cc
index f0c35746f34d..477637af2b63 100644
--- a/test/msan/Linux/sunrpc_bytes.cc
+++ b/test/msan/Linux/sunrpc_bytes.cc
@@ -1,6 +1,6 @@
-// RUN: %clangxx_msan -m64 -g -O0 %s -o %t && \
+// RUN: %clangxx_msan -g -O0 %s -o %t && \
// RUN: %run %t 2>&1
-// RUN: %clangxx_msan -m64 -g -O0 -DUNINIT=1 %s -o %t && \
+// RUN: %clangxx_msan -g -O0 -DUNINIT=1 %s -o %t && \
// RUN: not %run %t 2>&1 | FileCheck %s
#include <assert.h>
diff --git a/test/msan/Linux/sunrpc_string.cc b/test/msan/Linux/sunrpc_string.cc
index 3f44a96d114c..350222f5cc1e 100644
--- a/test/msan/Linux/sunrpc_string.cc
+++ b/test/msan/Linux/sunrpc_string.cc
@@ -1,6 +1,6 @@
-// RUN: %clangxx_msan -m64 -g -O0 %s -o %t && \
+// RUN: %clangxx_msan -g -O0 %s -o %t && \
// RUN: %run %t 2>&1
-// RUN: %clangxx_msan -m64 -g -O0 -DUNINIT=1 %s -o %t && \
+// RUN: %clangxx_msan -g -O0 -DUNINIT=1 %s -o %t && \
// RUN: not %run %t 2>&1 | FileCheck %s
#include <assert.h>
diff --git a/test/msan/Linux/syscalls.cc b/test/msan/Linux/syscalls.cc
index 4dd97e745148..78dba36638a6 100644
--- a/test/msan/Linux/syscalls.cc
+++ b/test/msan/Linux/syscalls.cc
@@ -1,5 +1,5 @@
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && %run %t 2>&1
-// RUN: %clangxx_msan -m64 -O3 %s -o %t && %run %t 2>&1
+// RUN: %clangxx_msan -O0 %s -o %t && %run %t 2>&1
+// RUN: %clangxx_msan -O3 %s -o %t && %run %t 2>&1
#include <assert.h>
#include <errno.h>
diff --git a/test/msan/Linux/tcgetattr.cc b/test/msan/Linux/tcgetattr.cc
index e1425b84f550..454b7fd1537e 100644
--- a/test/msan/Linux/tcgetattr.cc
+++ b/test/msan/Linux/tcgetattr.cc
@@ -1,4 +1,4 @@
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && %run %t %p
+// RUN: %clangxx_msan -O0 %s -o %t && %run %t %p
#include <assert.h>
#include <glob.h>
diff --git a/test/msan/Linux/xattr.cc b/test/msan/Linux/xattr.cc
index 1beba117d574..86cc2cd474d5 100644
--- a/test/msan/Linux/xattr.cc
+++ b/test/msan/Linux/xattr.cc
@@ -1,6 +1,6 @@
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && %run %t %p 2>&1
-// RUN: %clangxx_msan -m64 -O0 -D_FILE_OFFSET_BITS=64 %s -o %t && %run %t %p 2>&1
-// RUN: %clangxx_msan -m64 -O3 %s -o %t && %run %t %p 2>&1
+// RUN: %clangxx_msan -O0 %s -o %t && %run %t %p 2>&1
+// RUN: %clangxx_msan -O0 -D_FILE_OFFSET_BITS=64 %s -o %t && %run %t %p 2>&1
+// RUN: %clangxx_msan -O3 %s -o %t && %run %t %p 2>&1
#include <argz.h>
#include <assert.h>
diff --git a/test/msan/backtrace.cc b/test/msan/backtrace.cc
index 473e0ae8f88b..9cb883c5cf7d 100644
--- a/test/msan/backtrace.cc
+++ b/test/msan/backtrace.cc
@@ -1,4 +1,4 @@
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && %run %t
+// RUN: %clangxx_msan -O0 %s -o %t && %run %t
#include <assert.h>
#include <execinfo.h>
@@ -17,7 +17,7 @@ void f() {
char **s = backtrace_symbols(buf, sz);
assert(s > 0);
for (int i = 0; i < sz; ++i)
- printf("%d\n", strlen(s[i]));
+ printf("%d\n", (int)strlen(s[i]));
}
int main(void) {
diff --git a/test/msan/c-strdup.c b/test/msan/c-strdup.c
index 059300e4205a..b1e02b914fcd 100644
--- a/test/msan/c-strdup.c
+++ b/test/msan/c-strdup.c
@@ -1,7 +1,7 @@
-// RUN: %clang_msan -m64 -O0 %s -o %t && %run %t >%t.out 2>&1
-// RUN: %clang_msan -m64 -O1 %s -o %t && %run %t >%t.out 2>&1
-// RUN: %clang_msan -m64 -O2 %s -o %t && %run %t >%t.out 2>&1
-// RUN: %clang_msan -m64 -O3 %s -o %t && %run %t >%t.out 2>&1
+// RUN: %clang_msan -O0 %s -o %t && %run %t >%t.out 2>&1
+// RUN: %clang_msan -O1 %s -o %t && %run %t >%t.out 2>&1
+// RUN: %clang_msan -O2 %s -o %t && %run %t >%t.out 2>&1
+// RUN: %clang_msan -O3 %s -o %t && %run %t >%t.out 2>&1
// Test that strdup in C programs is intercepted.
// GLibC headers translate strdup to __strdup at -O1 and higher.
diff --git a/test/msan/chained_origin.cc b/test/msan/chained_origin.cc
index 336bbd852cb3..ae72c10b6ac8 100644
--- a/test/msan/chained_origin.cc
+++ b/test/msan/chained_origin.cc
@@ -1,17 +1,17 @@
-// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -m64 -O3 %s -o %t && \
+// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -O3 %s -o %t && \
// RUN: not %run %t >%t.out 2>&1
// RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-STACK < %t.out
-// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -DHEAP=1 -m64 -O3 %s -o %t && \
+// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -DHEAP=1 -O3 %s -o %t && \
// RUN: not %run %t >%t.out 2>&1
// RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-HEAP < %t.out
-// RUN: %clangxx_msan -mllvm -msan-instrumentation-with-call-threshold=0 -fsanitize-memory-track-origins=2 -m64 -O3 %s -o %t && \
+// RUN: %clangxx_msan -mllvm -msan-instrumentation-with-call-threshold=0 -fsanitize-memory-track-origins=2 -O3 %s -o %t && \
// RUN: not %run %t >%t.out 2>&1
// RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-STACK < %t.out
-// RUN: %clangxx_msan -mllvm -msan-instrumentation-with-call-threshold=0 -fsanitize-memory-track-origins=2 -DHEAP=1 -m64 -O3 %s -o %t && \
+// RUN: %clangxx_msan -mllvm -msan-instrumentation-with-call-threshold=0 -fsanitize-memory-track-origins=2 -DHEAP=1 -O3 %s -o %t && \
// RUN: not %run %t >%t.out 2>&1
// RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-HEAP < %t.out
diff --git a/test/msan/chained_origin_empty_stack.cc b/test/msan/chained_origin_empty_stack.cc
index 36727e3d7aa7..f1ed66b75e42 100644
--- a/test/msan/chained_origin_empty_stack.cc
+++ b/test/msan/chained_origin_empty_stack.cc
@@ -1,4 +1,4 @@
-// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -m64 -O3 %s -o %t && \
+// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -O3 %s -o %t && \
// RUN: MSAN_OPTIONS=store_context_size=1 not %run %t 2>&1 | FileCheck %s
// Test that stack trace for the intermediate store is not empty.
diff --git a/test/msan/chained_origin_limits.cc b/test/msan/chained_origin_limits.cc
index 0cc57f32a6ac..90fd09a86b29 100644
--- a/test/msan/chained_origin_limits.cc
+++ b/test/msan/chained_origin_limits.cc
@@ -1,7 +1,7 @@
// This test program creates a very large number of unique histories.
// Heap origin.
-// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -m64 -O3 %s -o %t
+// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -O3 %s -o %t
// RUN: MSAN_OPTIONS=origin_history_size=7 not %run %t >%t.out 2>&1
// RUN: FileCheck %s --check-prefix=CHECK7 < %t.out
@@ -16,7 +16,7 @@
// RUN: FileCheck %s --check-prefix=CHECK7 < %t.out
// Stack origin.
-// RUN: %clangxx_msan -DSTACK -fsanitize-memory-track-origins=2 -m64 -O3 %s -o %t
+// RUN: %clangxx_msan -DSTACK -fsanitize-memory-track-origins=2 -O3 %s -o %t
// RUN: MSAN_OPTIONS=origin_history_size=7 not %run %t >%t.out 2>&1
// RUN: FileCheck %s --check-prefix=CHECK7 < %t.out
@@ -32,7 +32,7 @@
// Heap origin, with calls.
-// RUN: %clangxx_msan -mllvm -msan-instrumentation-with-call-threshold=0 -fsanitize-memory-track-origins=2 -m64 -O3 %s -o %t
+// RUN: %clangxx_msan -mllvm -msan-instrumentation-with-call-threshold=0 -fsanitize-memory-track-origins=2 -O3 %s -o %t
// RUN: MSAN_OPTIONS=origin_history_size=7 not %run %t >%t.out 2>&1
// RUN: FileCheck %s --check-prefix=CHECK7 < %t.out
@@ -48,7 +48,7 @@
// Stack origin, with calls.
-// RUN: %clangxx_msan -DSTACK -mllvm -msan-instrumentation-with-call-threshold=0 -fsanitize-memory-track-origins=2 -m64 -O3 %s -o %t
+// RUN: %clangxx_msan -DSTACK -mllvm -msan-instrumentation-with-call-threshold=0 -fsanitize-memory-track-origins=2 -O3 %s -o %t
// RUN: MSAN_OPTIONS=origin_history_size=7 not %run %t >%t.out 2>&1
// RUN: FileCheck %s --check-prefix=CHECK7 < %t.out
diff --git a/test/msan/chained_origin_memcpy.cc b/test/msan/chained_origin_memcpy.cc
index f4c2f7fcac87..3fe0b77a0614 100644
--- a/test/msan/chained_origin_memcpy.cc
+++ b/test/msan/chained_origin_memcpy.cc
@@ -1,17 +1,17 @@
-// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -m64 -DOFFSET=0 -O3 %s -o %t && \
+// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -DOFFSET=0 -O3 %s -o %t && \
// RUN: not %run %t >%t.out 2>&1
// RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-Z1 < %t.out
-// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -DOFFSET=10 -m64 -O3 %s -o %t && \
+// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -DOFFSET=10 -O3 %s -o %t && \
// RUN: not %run %t >%t.out 2>&1
// RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-Z2 < %t.out
-// RUN: %clangxx_msan -mllvm -msan-instrumentation-with-call-threshold=0 -fsanitize-memory-track-origins=2 -m64 -DOFFSET=0 -O3 %s -o %t && \
+// RUN: %clangxx_msan -mllvm -msan-instrumentation-with-call-threshold=0 -fsanitize-memory-track-origins=2 -DOFFSET=0 -O3 %s -o %t && \
// RUN: not %run %t >%t.out 2>&1
// RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-Z1 < %t.out
-// RUN: %clangxx_msan -mllvm -msan-instrumentation-with-call-threshold=0 -fsanitize-memory-track-origins=2 -DOFFSET=10 -m64 -O3 %s -o %t && \
+// RUN: %clangxx_msan -mllvm -msan-instrumentation-with-call-threshold=0 -fsanitize-memory-track-origins=2 -DOFFSET=10 -O3 %s -o %t && \
// RUN: not %run %t >%t.out 2>&1
// RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-Z2 < %t.out
diff --git a/test/msan/chained_origin_with_signals.cc b/test/msan/chained_origin_with_signals.cc
index 2841e34a1f1d..43dbdcca76a9 100644
--- a/test/msan/chained_origin_with_signals.cc
+++ b/test/msan/chained_origin_with_signals.cc
@@ -2,11 +2,11 @@
// This is, in fact, undesired behavior caused by our chained origins
// implementation being not async-signal-safe.
-// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -m64 -O3 %s -o %t && \
+// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -O3 %s -o %t && \
// RUN: not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
-// RUN: %clangxx_msan -mllvm -msan-instrumentation-with-call-threshold=0 -fsanitize-memory-track-origins=2 -m64 -O3 %s -o %t && \
+// RUN: %clangxx_msan -mllvm -msan-instrumentation-with-call-threshold=0 -fsanitize-memory-track-origins=2 -O3 %s -o %t && \
// RUN: not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
diff --git a/test/msan/check_mem_is_initialized.cc b/test/msan/check_mem_is_initialized.cc
index 7d2328810d90..e1d3b117e42f 100644
--- a/test/msan/check_mem_is_initialized.cc
+++ b/test/msan/check_mem_is_initialized.cc
@@ -1,19 +1,19 @@
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O0 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
-// RUN: %clangxx_msan -m64 -O1 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O1 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
-// RUN: %clangxx_msan -m64 -O2 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O2 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
-// RUN: %clangxx_msan -m64 -O3 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O3 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O0 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O0 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O1 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O1 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O2 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O2 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O3 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O3 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out
#include <sanitizer/msan_interface.h>
diff --git a/test/msan/coverage-levels.cc b/test/msan/coverage-levels.cc
index 7c2e143d3ab8..d71bfecb2ebb 100644
--- a/test/msan/coverage-levels.cc
+++ b/test/msan/coverage-levels.cc
@@ -1,13 +1,13 @@
// Test various levels of coverage
//
-// RUN: %clangxx_msan -DINIT_VAR=1 -O1 -fsanitize-coverage=1 %s -o %t
+// RUN: %clangxx_msan -DINIT_VAR=1 -O1 -fsanitize-coverage=func %s -o %t
// RUN: mkdir -p %T/coverage-levels
// RUN: MSAN_OPTIONS=coverage=1:verbosity=1:coverage_dir=%T/coverage-levels %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_NOWARN
-// RUN: %clangxx_msan -O1 -fsanitize-coverage=1 %s -o %t
+// RUN: %clangxx_msan -O1 -fsanitize-coverage=func %s -o %t
// RUN: MSAN_OPTIONS=coverage=1:verbosity=1:coverage_dir=%T/coverage-levels not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_WARN
-// RUN: %clangxx_msan -O1 -fsanitize-coverage=2 %s -o %t
+// RUN: %clangxx_msan -O1 -fsanitize-coverage=bb %s -o %t
// RUN: MSAN_OPTIONS=coverage=1:verbosity=1:coverage_dir=%T/coverage-levels not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK2 --check-prefix=CHECK_WARN
-// RUN: %clangxx_msan -O1 -fsanitize-coverage=3 %s -o %t
+// RUN: %clangxx_msan -O1 -fsanitize-coverage=edge %s -o %t
// RUN: MSAN_OPTIONS=coverage=1:verbosity=1:coverage_dir=%T/coverage-levels not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK3 --check-prefix=CHECK_WARN
//
volatile int sink;
diff --git a/test/msan/cxa_atexit.cc b/test/msan/cxa_atexit.cc
index 0aa36ecee011..70384b9c93f8 100644
--- a/test/msan/cxa_atexit.cc
+++ b/test/msan/cxa_atexit.cc
@@ -1,4 +1,4 @@
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && %run %t %p
+// RUN: %clangxx_msan -O0 %s -o %t && %run %t %p
// PR17377: C++ module destructors get stale argument shadow.
diff --git a/test/msan/death-callback.cc b/test/msan/death-callback.cc
index 6d0488339998..08cf2911b0f9 100644
--- a/test/msan/death-callback.cc
+++ b/test/msan/death-callback.cc
@@ -1,10 +1,10 @@
-// RUN: %clangxx_msan -m64 -DERROR %s -o %t && not %run %t 2>&1 | \
+// RUN: %clangxx_msan -DERROR %s -o %t && not %run %t 2>&1 | \
// RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-NOCB
-// RUN: %clangxx_msan -m64 -DERROR -DMSANCB_SET %s -o %t && not %run %t 2>&1 | \
+// RUN: %clangxx_msan -DERROR -DMSANCB_SET %s -o %t && not %run %t 2>&1 | \
// RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-CB
-// RUN: %clangxx_msan -m64 -DERROR -DMSANCB_SET -DMSANCB_CLEAR %s -o %t && not %run %t 2>&1 | \
+// RUN: %clangxx_msan -DERROR -DMSANCB_SET -DMSANCB_CLEAR %s -o %t && not %run %t 2>&1 | \
// RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-NOCB
-// RUN: %clangxx_msan -m64 -DMSANCB_SET %s -o %t && %run %t 2>&1 | \
+// RUN: %clangxx_msan -DMSANCB_SET %s -o %t && %run %t 2>&1 | \
// RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-NOCB
#include <sanitizer/msan_interface.h>
diff --git a/test/msan/dlerror.cc b/test/msan/dlerror.cc
index 2c726d36041e..d5510b65c4a5 100644
--- a/test/msan/dlerror.cc
+++ b/test/msan/dlerror.cc
@@ -1,4 +1,4 @@
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && %run %t
+// RUN: %clangxx_msan -O0 %s -o %t && %run %t
#include <assert.h>
#include <dlfcn.h>
diff --git a/test/msan/dso-origin.cc b/test/msan/dso-origin.cc
index ba008c00718d..7f62449842ce 100644
--- a/test/msan/dso-origin.cc
+++ b/test/msan/dso-origin.cc
@@ -1,7 +1,7 @@
// Build a library with origin tracking and an executable w/o origin tracking.
// Test that origin tracking is enabled at runtime.
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O0 %s -DBUILD_SO -fPIC -shared -o %t-so.so
-// RUN: %clangxx_msan -m64 -O0 %s %t-so.so -o %t && not %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O0 %s -DBUILD_SO -fPIC -shared -o %t-so.so
+// RUN: %clangxx_msan -O0 %s %t-so.so -o %t && not %run %t 2>&1 | FileCheck %s
#ifdef BUILD_SO
diff --git a/test/msan/dtls_test.c b/test/msan/dtls_test.c
index cb88ede2f0a6..4036f71a7f8e 100644
--- a/test/msan/dtls_test.c
+++ b/test/msan/dtls_test.c
@@ -1,5 +1,5 @@
-/* RUN: %clang_msan -g -m64 %s -o %t
- RUN: %clang_msan -g -m64 %s -DBUILD_SO -fPIC -o %t-so.so -shared
+/* RUN: %clang_msan -g %s -o %t
+ RUN: %clang_msan -g %s -DBUILD_SO -fPIC -o %t-so.so -shared
RUN: %run %t 2>&1
Regression test for a bug in msan/glibc integration,
diff --git a/test/msan/errno.cc b/test/msan/errno.cc
index 8af8eb5ee6f9..6ed0fd4108e6 100644
--- a/test/msan/errno.cc
+++ b/test/msan/errno.cc
@@ -1,4 +1,4 @@
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && %run %t
+// RUN: %clangxx_msan -O0 %s -o %t && %run %t
#include <assert.h>
#include <errno.h>
diff --git a/test/msan/fork.cc b/test/msan/fork.cc
index 10de8a9379d8..78a62d549ec3 100644
--- a/test/msan/fork.cc
+++ b/test/msan/fork.cc
@@ -2,7 +2,7 @@
// Run a number of threads that create new chained origins, then fork
// and verify that origin reads do not deadlock in the child process.
-// RUN: %clangxx_msan -std=c++11 -fsanitize-memory-track-origins=2 -g -m64 -O3 %s -o %t
+// RUN: %clangxx_msan -std=c++11 -fsanitize-memory-track-origins=2 -g -O3 %s -o %t
// RUN: MSAN_OPTIONS=store_context_size=1000,origin_history_size=0,origin_history_per_stack_limit=0 %run %t |& FileCheck %s
// Fun fact: if test output is redirected to a file (as opposed to
diff --git a/test/msan/ftime.cc b/test/msan/ftime.cc
index 2d0935d18037..7a5a2fbf7dce 100644
--- a/test/msan/ftime.cc
+++ b/test/msan/ftime.cc
@@ -1,4 +1,7 @@
-// RUN: %clangxx_msan -m64 -O0 -g %s -o %t && %run %t
+// RUN: %clangxx_msan -O0 -g %s -o %t && %run %t
+
+// ftime() is deprecated on FreeBSD.
+// XFAIL: freebsd
#include <assert.h>
#include <sys/timeb.h>
diff --git a/test/msan/getaddrinfo-positive.cc b/test/msan/getaddrinfo-positive.cc
index 7658cd504dba..45c1b604d1e3 100644
--- a/test/msan/getaddrinfo-positive.cc
+++ b/test/msan/getaddrinfo-positive.cc
@@ -1,6 +1,6 @@
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O0 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
-// RUN: %clangxx_msan -m64 -O3 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O3 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
#include <sys/types.h>
diff --git a/test/msan/getaddrinfo.cc b/test/msan/getaddrinfo.cc
index abab8bd78f75..c9dcf3ecbae5 100644
--- a/test/msan/getaddrinfo.cc
+++ b/test/msan/getaddrinfo.cc
@@ -1,4 +1,4 @@
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && %run %t
+// RUN: %clangxx_msan -O0 %s -o %t && %run %t
#include <sys/types.h>
#include <sys/socket.h>
diff --git a/test/msan/getc_unlocked.c b/test/msan/getc_unlocked.c
index 7df958ad657a..8468fed5ccfa 100644
--- a/test/msan/getc_unlocked.c
+++ b/test/msan/getc_unlocked.c
@@ -1,12 +1,12 @@
-// RUN: %clangxx_msan -DGETC -m64 -O0 -g -xc++ %s -o %t && %run %t
-// RUN: %clangxx_msan -DGETC -m64 -O3 -g -xc++ %s -o %t && %run %t
-// RUN: %clang_msan -DGETC -m64 -O0 -g %s -o %t && %run %t
-// RUN: %clang_msan -DGETC -m64 -O3 -g %s -o %t && %run %t
+// RUN: %clangxx_msan -DGETC -O0 -g -xc++ %s -o %t && %run %t
+// RUN: %clangxx_msan -DGETC -O3 -g -xc++ %s -o %t && %run %t
+// RUN: %clang_msan -DGETC -O0 -g %s -o %t && %run %t
+// RUN: %clang_msan -DGETC -O3 -g %s -o %t && %run %t
-// RUN: %clangxx_msan -DGETCHAR -m64 -O0 -g -xc++ %s -o %t && %run %t
-// RUN: %clangxx_msan -DGETCHAR -m64 -O3 -g -xc++ %s -o %t && %run %t
-// RUN: %clang_msan -DGETCHAR -m64 -O0 -g %s -o %t && %run %t
-// RUN: %clang_msan -DGETCHAR -m64 -O3 -g %s -o %t && %run %t
+// RUN: %clangxx_msan -DGETCHAR -O0 -g -xc++ %s -o %t && %run %t
+// RUN: %clangxx_msan -DGETCHAR -O3 -g -xc++ %s -o %t && %run %t
+// RUN: %clang_msan -DGETCHAR -O0 -g %s -o %t && %run %t
+// RUN: %clang_msan -DGETCHAR -O3 -g %s -o %t && %run %t
#include <assert.h>
#include <stdio.h>
diff --git a/test/msan/getline.cc b/test/msan/getline.cc
index 51e105e0be5c..ee12d4ddc529 100644
--- a/test/msan/getline.cc
+++ b/test/msan/getline.cc
@@ -7,6 +7,10 @@
// RUN: %clang_msan -O0 -xc -D_GNU_SOURCE=1 %s -o %t && %run %t %t-testdata
// RUN: %clang_msan -O2 -xc -D_GNU_SOURCE=1 %s -o %t && %run %t %t-testdata
+#if defined(__FreeBSD__)
+#define _WITH_GETLINE // To declare getline().
+#endif
+
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/test/msan/heap-origin.cc b/test/msan/heap-origin.cc
index 0920001beed7..4f170f0d7377 100644
--- a/test/msan/heap-origin.cc
+++ b/test/msan/heap-origin.cc
@@ -1,19 +1,19 @@
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O0 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
-// RUN: %clangxx_msan -m64 -O1 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O1 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
-// RUN: %clangxx_msan -m64 -O2 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O2 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
-// RUN: %clangxx_msan -m64 -O3 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O3 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O0 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O0 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O1 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O1 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O2 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O2 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O3 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O3 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out
#include <stdlib.h>
diff --git a/test/msan/iconv.cc b/test/msan/iconv.cc
index ea6958b79b96..c2da938169b3 100644
--- a/test/msan/iconv.cc
+++ b/test/msan/iconv.cc
@@ -1,5 +1,5 @@
-// RUN: %clangxx_msan -m64 -O0 -g %s -o %t && %run %t
-// RUN: %clangxx_msan -m64 -O0 -g -DPOSITIVE %s -o %t && not %run %t |& FileCheck %s
+// RUN: %clangxx_msan -O0 -g %s -o %t && %run %t
+// RUN: %clangxx_msan -O0 -g -DPOSITIVE %s -o %t && not %run %t |& FileCheck %s
#include <assert.h>
#include <iconv.h>
@@ -15,7 +15,12 @@ int main(void) {
char inbuf_[100];
strcpy(inbuf_, "sample text");
char outbuf_[100];
+#if defined(__FreeBSD__)
+ // FreeBSD's iconv() expects the 2nd argument be of type 'const char**'.
+ const char *inbuf = inbuf_;
+#else
char *inbuf = inbuf_;
+#endif
char *outbuf = outbuf_;
size_t inbytesleft = strlen(inbuf_);
size_t outbytesleft = sizeof(outbuf_);
diff --git a/test/msan/if_indextoname.cc b/test/msan/if_indextoname.cc
index b74aec16c98a..7b1b989e57d5 100644
--- a/test/msan/if_indextoname.cc
+++ b/test/msan/if_indextoname.cc
@@ -1,6 +1,6 @@
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && %run %t 2>&1
-// RUN: %clangxx_msan -m64 -O0 -D_FILE_OFFSET_BITS=64 %s -o %t && %run %t 2>&1
-// RUN: %clangxx_msan -m64 -O3 %s -o %t && %run %t 2>&1
+// RUN: %clangxx_msan -O0 %s -o %t && %run %t 2>&1
+// RUN: %clangxx_msan -O0 -D_FILE_OFFSET_BITS=64 %s -o %t && %run %t 2>&1
+// RUN: %clangxx_msan -O3 %s -o %t && %run %t 2>&1
#include <assert.h>
#include <errno.h>
@@ -18,6 +18,6 @@ int main(int argc, char *argv[]) {
printf("No network interfaces found.\n");
return 0;
}
- assert(strlen(ifname) + 1 == __msan_test_shadow(ifname, sizeof(ifname)));
+ assert(strlen(ifname) + 1 <= __msan_test_shadow(ifname, sizeof(ifname)));
return 0;
}
diff --git a/test/msan/ifaddrs.cc b/test/msan/ifaddrs.cc
index 6a0db3a5b71f..6f5eb935ab52 100644
--- a/test/msan/ifaddrs.cc
+++ b/test/msan/ifaddrs.cc
@@ -1,6 +1,6 @@
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && %run %t %p 2>&1
-// RUN: %clangxx_msan -m64 -O0 -D_FILE_OFFSET_BITS=64 %s -o %t && %run %t %p 2>&1
-// RUN: %clangxx_msan -m64 -O3 %s -o %t && %run %t %p 2>&1
+// RUN: %clangxx_msan -O0 %s -o %t && %run %t %p 2>&1
+// RUN: %clangxx_msan -O0 -D_FILE_OFFSET_BITS=64 %s -o %t && %run %t %p 2>&1
+// RUN: %clangxx_msan -O3 %s -o %t && %run %t %p 2>&1
#include <assert.h>
#include <errno.h>
@@ -10,6 +10,10 @@
#include <vector>
+#if defined(__FreeBSD__)
+#include <sys/socket.h> // To define 'struct sockaddr'.
+#endif
+
#include <sanitizer/msan_interface.h>
#define CHECK_AND_PUSH(addr, size) \
diff --git a/test/msan/initgroups.cc b/test/msan/initgroups.cc
index 94f6cd8252f3..974b1cbaa666 100644
--- a/test/msan/initgroups.cc
+++ b/test/msan/initgroups.cc
@@ -1,7 +1,8 @@
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && %run %t
+// RUN: %clangxx_msan -O0 %s -o %t && %run %t
#include <sys/types.h>
#include <grp.h>
+#include <unistd.h> // FreeBSD declares initgroups() here.
int main(void) {
initgroups("root", 0);
diff --git a/test/msan/insertvalue_origin.cc b/test/msan/insertvalue_origin.cc
index 545debffaad5..a0c70023f2f6 100644
--- a/test/msan/insertvalue_origin.cc
+++ b/test/msan/insertvalue_origin.cc
@@ -1,6 +1,6 @@
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O0 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O0 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out && FileCheck %s < %t.out
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O3 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O3 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out && FileCheck %s < %t.out
// Test origin propagation through insertvalue IR instruction.
diff --git a/test/msan/ioctl.cc b/test/msan/ioctl.cc
index caa5c274f5eb..e21ef636c604 100644
--- a/test/msan/ioctl.cc
+++ b/test/msan/ioctl.cc
@@ -1,5 +1,5 @@
-// RUN: %clangxx_msan -m64 -O0 -g %s -o %t && %run %t
-// RUN: %clangxx_msan -m64 -O3 -g %s -o %t && %run %t
+// RUN: %clangxx_msan -O0 -g %s -o %t && %run %t
+// RUN: %clangxx_msan -O3 -g %s -o %t && %run %t
#include <assert.h>
#include <stdlib.h>
diff --git a/test/msan/ioctl_custom.cc b/test/msan/ioctl_custom.cc
index 7c7fde4bd5d0..6df22d75e95e 100644
--- a/test/msan/ioctl_custom.cc
+++ b/test/msan/ioctl_custom.cc
@@ -1,8 +1,8 @@
-// RUN: %clangxx_msan -m64 -O0 -g %s -o %t && %run %t
-// RUN: %clangxx_msan -m64 -O3 -g %s -o %t && %run %t
+// RUN: %clangxx_msan -O0 -g %s -o %t && %run %t
+// RUN: %clangxx_msan -O3 -g %s -o %t && %run %t
-// RUN: %clangxx_msan -DPOSITIVE -m64 -O0 -g %s -o %t && not %run %t 2>&1 | FileCheck %s
-// RUN: %clangxx_msan -DPOSITIVE -m64 -O3 -g %s -o %t && not %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_msan -DPOSITIVE -O0 -g %s -o %t && not %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_msan -DPOSITIVE -O3 -g %s -o %t && not %run %t 2>&1 | FileCheck %s
#include <assert.h>
#include <stdlib.h>
diff --git a/test/msan/keep-going-dso.cc b/test/msan/keep-going-dso.cc
index 7975306c557f..f32a513ea9e7 100644
--- a/test/msan/keep-going-dso.cc
+++ b/test/msan/keep-going-dso.cc
@@ -1,15 +1,15 @@
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O0 %s -o %t && not %run %t >%t.out 2>&1
// FileCheck --check-prefix=CHECK-KEEP-GOING %s <%t.out
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && MSAN_OPTIONS=keep_going=0 not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O0 %s -o %t && MSAN_OPTIONS=keep_going=0 not %run %t >%t.out 2>&1
// FileCheck %s <%t.out
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && MSAN_OPTIONS=keep_going=1 not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O0 %s -o %t && MSAN_OPTIONS=keep_going=1 not %run %t >%t.out 2>&1
// FileCheck --check-prefix=CHECK-KEEP-GOING %s <%t.out
-// RUN: %clangxx_msan -m64 -mllvm -msan-keep-going=1 -O0 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -mllvm -msan-keep-going=1 -O0 %s -o %t && not %run %t >%t.out 2>&1
// FileCheck --check-prefix=CHECK-KEEP-GOING %s <%t.out
-// RUN: %clangxx_msan -m64 -mllvm -msan-keep-going=1 -O0 %s -o %t && MSAN_OPTIONS=keep_going=0 not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -mllvm -msan-keep-going=1 -O0 %s -o %t && MSAN_OPTIONS=keep_going=0 not %run %t >%t.out 2>&1
// FileCheck %s <%t.out
-// RUN: %clangxx_msan -m64 -mllvm -msan-keep-going=1 -O0 %s -o %t && MSAN_OPTIONS=keep_going=1 not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -mllvm -msan-keep-going=1 -O0 %s -o %t && MSAN_OPTIONS=keep_going=1 not %run %t >%t.out 2>&1
// FileCheck --check-prefix=CHECK-KEEP-GOING %s <%t.out
// Test how -mllvm -msan-keep-going and MSAN_OPTIONS=keep_going affect reports
diff --git a/test/msan/keep-going.cc b/test/msan/keep-going.cc
index 6426574a9e50..57729756357d 100644
--- a/test/msan/keep-going.cc
+++ b/test/msan/keep-going.cc
@@ -1,19 +1,19 @@
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O0 %s -o %t && not %run %t >%t.out 2>&1
// FileCheck %s <%t.out
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && MSAN_OPTIONS=keep_going=0 not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O0 %s -o %t && MSAN_OPTIONS=keep_going=0 not %run %t >%t.out 2>&1
// FileCheck %s <%t.out
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && MSAN_OPTIONS=keep_going=1 not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O0 %s -o %t && MSAN_OPTIONS=keep_going=1 not %run %t >%t.out 2>&1
// FileCheck %s <%t.out
-// RUN: %clangxx_msan -m64 -mllvm -msan-keep-going=1 -O0 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -mllvm -msan-keep-going=1 -O0 %s -o %t && not %run %t >%t.out 2>&1
// FileCheck --check-prefix=CHECK-KEEP-GOING %s <%t.out
-// RUN: %clangxx_msan -m64 -mllvm -msan-keep-going=1 -O0 %s -o %t && MSAN_OPTIONS=keep_going=0 not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -mllvm -msan-keep-going=1 -O0 %s -o %t && MSAN_OPTIONS=keep_going=0 not %run %t >%t.out 2>&1
// FileCheck %s <%t.out
-// RUN: %clangxx_msan -m64 -mllvm -msan-keep-going=1 -O0 %s -o %t && MSAN_OPTIONS=keep_going=1 not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -mllvm -msan-keep-going=1 -O0 %s -o %t && MSAN_OPTIONS=keep_going=1 not %run %t >%t.out 2>&1
// FileCheck --check-prefix=CHECK-KEEP-GOING %s <%t.out
-// RUN: %clangxx_msan -m64 -mllvm -msan-keep-going=1 -O0 %s -o %t && MSAN_OPTIONS=halt_on_error=1 not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -mllvm -msan-keep-going=1 -O0 %s -o %t && MSAN_OPTIONS=halt_on_error=1 not %run %t >%t.out 2>&1
// FileCheck %s <%t.out
-// RUN: %clangxx_msan -m64 -mllvm -msan-keep-going=1 -O0 %s -o %t && MSAN_OPTIONS=halt_on_error=0 not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -mllvm -msan-keep-going=1 -O0 %s -o %t && MSAN_OPTIONS=halt_on_error=0 not %run %t >%t.out 2>&1
// FileCheck --check-prefix=CHECK-KEEP-GOING %s <%t.out
// Test behaviour of -mllvm -msan-keep-going and MSAN_OPTIONS=keep_going.
diff --git a/test/msan/lit.cfg b/test/msan/lit.cfg
index f425e25957ac..011ccd2fae74 100644
--- a/test/msan/lit.cfg
+++ b/test/msan/lit.cfg
@@ -14,6 +14,9 @@ clang_msan_cflags = ["-fsanitize=memory",
"-fno-omit-frame-pointer",
"-fno-optimize-sibling-calls",
"-m64"] + config.debug_info_flags
+# Some Msan tests leverage backtrace() which requires libexecinfo on FreeBSD.
+if config.host_os == 'FreeBSD':
+ clang_msan_cflags += ["-lexecinfo"]
clang_msan_cxxflags = config.cxx_mode_flags + clang_msan_cflags
def build_invocation(compile_flags):
diff --git a/test/msan/mktime.cc b/test/msan/mktime.cc
index c419057c3907..997fb0ddbbab 100644
--- a/test/msan/mktime.cc
+++ b/test/msan/mktime.cc
@@ -1,5 +1,5 @@
-// RUN: %clangxx_msan -m64 -O0 -g %s -o %t && %run %t
-// RUN: %clangxx_msan -m64 -O0 -g -DUNINIT %s -o %t && not %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_msan -O0 -g %s -o %t && %run %t
+// RUN: %clangxx_msan -O0 -g -DUNINIT %s -o %t && not %run %t 2>&1 | FileCheck %s
#include <assert.h>
#include <time.h>
diff --git a/test/msan/mmap.cc b/test/msan/mmap.cc
new file mode 100644
index 000000000000..c09fcb76a827
--- /dev/null
+++ b/test/msan/mmap.cc
@@ -0,0 +1,45 @@
+// Test that mmap (without MAP_FIXED) always returns valid application addresses.
+// RUN: %clangxx_msan -O0 %s -o %t && %run %t
+// RUN: %clangxx_msan -O0 -fsanitize-memory-track-origins %s -o %t && %run %t
+
+#include <assert.h>
+#include <errno.h>
+#include <stdint.h>
+#include <sys/mman.h>
+#include <stdio.h>
+
+bool AddrIsApp(void *p) {
+ uintptr_t addr = (uintptr_t)p;
+#if defined(__FreeBSD__) && defined(__x86_64__)
+ return addr < 0x010000000000ULL || addr >= 0x600000000000ULL;
+#elif defined(__x86_64__)
+ return addr >= 0x600000000000ULL;
+#elif defined(__mips64)
+ return addr >= 0x00e000000000ULL;
+#elif defined(__powerpc64__)
+ return addr < 0x000100000000ULL || addr >= 0x300000000000ULL;
+#endif
+}
+
+int main() {
+ // Large enough to quickly exhaust the entire address space.
+#if defined(__mips64)
+ const size_t kMapSize = 0x100000000ULL;
+#else
+ const size_t kMapSize = 0x1000000000ULL;
+#endif
+ int success_count = 0;
+ while (true) {
+ void *p = mmap(0, kMapSize, PROT_WRITE,
+ MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, -1, 0);
+ printf("%p\n", p);
+ if (p == MAP_FAILED) {
+ assert(errno == ENOMEM);
+ break;
+ }
+ assert(AddrIsApp(p));
+ success_count++;
+ }
+ printf("successful mappings: %d\n", success_count);
+ assert(success_count > 5);
+}
diff --git a/test/msan/mmap_below_shadow.cc b/test/msan/mmap_below_shadow.cc
index 0b982d58930d..563d8774f525 100644
--- a/test/msan/mmap_below_shadow.cc
+++ b/test/msan/mmap_below_shadow.cc
@@ -3,10 +3,10 @@
// Without MAP_FIXED, we ignore the address hint and map somewhere in
// application range.
-// RUN: %clangxx_msan -m64 -O0 -DFIXED=0 %s -o %t && %run %t
-// RUN: %clangxx_msan -m64 -O0 -DFIXED=1 %s -o %t && %run %t
-// RUN: %clangxx_msan -m64 -O0 -DFIXED=0 -D_FILE_OFFSET_BITS=64 %s -o %t && %run %t
-// RUN: %clangxx_msan -m64 -O0 -DFIXED=1 -D_FILE_OFFSET_BITS=64 %s -o %t && %run %t
+// RUN: %clangxx_msan -O0 -DFIXED=0 %s -o %t && %run %t
+// RUN: %clangxx_msan -O0 -DFIXED=1 %s -o %t && %run %t
+// RUN: %clangxx_msan -O0 -DFIXED=0 -D_FILE_OFFSET_BITS=64 %s -o %t && %run %t
+// RUN: %clangxx_msan -O0 -DFIXED=1 -D_FILE_OFFSET_BITS=64 %s -o %t && %run %t
#include <assert.h>
#include <errno.h>
@@ -15,12 +15,18 @@
int main(void) {
// Hint address just below shadow.
-#if defined(__x86_64__)
+#if defined(__FreeBSD__) && defined(__x86_64__)
+ uintptr_t hint = 0x0f0000000000ULL;
+ const uintptr_t app_start = 0x000000000000ULL;
+#elif defined(__x86_64__)
uintptr_t hint = 0x4f0000000000ULL;
const uintptr_t app_start = 0x600000000000ULL;
#elif defined (__mips64)
uintptr_t hint = 0x4f00000000ULL;
const uintptr_t app_start = 0x6000000000ULL;
+#elif defined (__powerpc64__)
+ uintptr_t hint = 0x2f0000000000ULL;
+ const uintptr_t app_start = 0x300000000000ULL;
#endif
uintptr_t p = (uintptr_t)mmap(
(void *)hint, 4096, PROT_WRITE,
diff --git a/test/msan/msan_check_mem_is_initialized.cc b/test/msan/msan_check_mem_is_initialized.cc
index 33558cd2feb2..599cf2d7dd46 100644
--- a/test/msan/msan_check_mem_is_initialized.cc
+++ b/test/msan/msan_check_mem_is_initialized.cc
@@ -1,9 +1,9 @@
-// RUN: %clangxx_msan -m64 -O0 -g -DPOSITIVE %s -o %t
+// RUN: %clangxx_msan -O0 -g -DPOSITIVE %s -o %t
// RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK
// RUN: MSAN_OPTIONS=verbosity=1 not %run %t 2>&1 | \
// RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-VERBOSE
-// RUN: %clangxx_msan -m64 -O0 -g %s -o %t && %run %t
+// RUN: %clangxx_msan -O0 -g %s -o %t && %run %t
#include <sanitizer/msan_interface.h>
diff --git a/test/msan/msan_dump_shadow.cc b/test/msan/msan_dump_shadow.cc
index 08371e306f32..543fa7013223 100644
--- a/test/msan/msan_dump_shadow.cc
+++ b/test/msan/msan_dump_shadow.cc
@@ -1,10 +1,10 @@
-// RUN: %clangxx_msan -m64 -O0 -g %s -o %t && %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O0 -g %s -o %t && %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O0 -g %s -o %t && %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O0 -g %s -o %t && %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
-// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -m64 -O0 -g %s -o %t && %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -O0 -g %s -o %t && %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
#include <sanitizer/msan_interface.h>
diff --git a/test/msan/msan_print_shadow.cc b/test/msan/msan_print_shadow.cc
index f4894596a0e2..9668be2c240f 100644
--- a/test/msan/msan_print_shadow.cc
+++ b/test/msan/msan_print_shadow.cc
@@ -1,10 +1,10 @@
-// RUN: %clangxx_msan -m64 -O0 -g %s -o %t && %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O0 -g %s -o %t && %run %t >%t.out 2>&1
// RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-NO-ORIGINS < %t.out
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O0 -g %s -o %t && %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O0 -g %s -o %t && %run %t >%t.out 2>&1
// RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-ORIGINS < %t.out
-// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -m64 -O0 -g %s -o %t && %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -O0 -g %s -o %t && %run %t >%t.out 2>&1
// RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-ORIGINS --check-prefix=CHECK-ORIGINS-2 < %t.out
#include <sanitizer/msan_interface.h>
diff --git a/test/msan/msan_print_shadow2.cc b/test/msan/msan_print_shadow2.cc
index 343ee9e5c3de..5095081c9655 100644
--- a/test/msan/msan_print_shadow2.cc
+++ b/test/msan/msan_print_shadow2.cc
@@ -1,10 +1,10 @@
-// RUN: %clangxx_msan -m64 -O0 -g %s -o %t && %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O0 -g %s -o %t && %run %t >%t.out 2>&1
// RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-NO-ORIGINS < %t.out
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O0 -g %s -o %t && %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O0 -g %s -o %t && %run %t >%t.out 2>&1
// RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-ORIGINS < %t.out
-// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -m64 -O0 -g %s -o %t && %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -O0 -g %s -o %t && %run %t >%t.out 2>&1
// RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-ORIGINS < %t.out
#include <sanitizer/msan_interface.h>
diff --git a/test/msan/msan_print_shadow3.cc b/test/msan/msan_print_shadow3.cc
index c605ef18886d..b29f3222dc33 100644
--- a/test/msan/msan_print_shadow3.cc
+++ b/test/msan/msan_print_shadow3.cc
@@ -1,4 +1,4 @@
-// RUN: %clangxx_msan -m64 -O0 -g %s -o %t && %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O0 -g %s -o %t && %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
#include <stdint.h>
diff --git a/test/msan/mul_by_const.cc b/test/msan/mul_by_const.cc
index a975bb92167e..8240fdbedb5b 100644
--- a/test/msan/mul_by_const.cc
+++ b/test/msan/mul_by_const.cc
@@ -1,4 +1,4 @@
-// RUN: %clangxx_msan -m64 -O2 %s -o %t && %run %t
+// RUN: %clangxx_msan -O2 %s -o %t && %run %t
#include <sanitizer/msan_interface.h>
diff --git a/test/msan/no_sanitize_memory.cc b/test/msan/no_sanitize_memory.cc
index c5643816c281..5c53ee4f3482 100644
--- a/test/msan/no_sanitize_memory.cc
+++ b/test/msan/no_sanitize_memory.cc
@@ -1,12 +1,12 @@
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && %run %t >%t.out 2>&1
-// RUN: %clangxx_msan -m64 -O1 %s -o %t && %run %t >%t.out 2>&1
-// RUN: %clangxx_msan -m64 -O2 %s -o %t && %run %t >%t.out 2>&1
-// RUN: %clangxx_msan -m64 -O3 %s -o %t && %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O0 %s -o %t && %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O1 %s -o %t && %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O2 %s -o %t && %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O3 %s -o %t && %run %t >%t.out 2>&1
-// RUN: %clangxx_msan -m64 -O0 %s -o %t -DCHECK_IN_F && %run %t >%t.out 2>&1
-// RUN: %clangxx_msan -m64 -O1 %s -o %t -DCHECK_IN_F && %run %t >%t.out 2>&1
-// RUN: %clangxx_msan -m64 -O2 %s -o %t -DCHECK_IN_F && %run %t >%t.out 2>&1
-// RUN: %clangxx_msan -m64 -O3 %s -o %t -DCHECK_IN_F && %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O0 %s -o %t -DCHECK_IN_F && %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O1 %s -o %t -DCHECK_IN_F && %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O2 %s -o %t -DCHECK_IN_F && %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O3 %s -o %t -DCHECK_IN_F && %run %t >%t.out 2>&1
// Test that (no_sanitize_memory) functions
// * don't check shadow values (-DCHECK_IN_F)
diff --git a/test/msan/no_sanitize_memory_prop.cc b/test/msan/no_sanitize_memory_prop.cc
index 4275ebbf78e1..bfd4194dd266 100644
--- a/test/msan/no_sanitize_memory_prop.cc
+++ b/test/msan/no_sanitize_memory_prop.cc
@@ -1,7 +1,7 @@
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && %run %t >%t.out 2>&1
-// RUN: %clangxx_msan -m64 -O1 %s -o %t && %run %t >%t.out 2>&1
-// RUN: %clangxx_msan -m64 -O2 %s -o %t && %run %t >%t.out 2>&1
-// RUN: %clangxx_msan -m64 -O3 %s -o %t && %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O0 %s -o %t && %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O1 %s -o %t && %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O2 %s -o %t && %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O3 %s -o %t && %run %t >%t.out 2>&1
// Test that (no_sanitize_memory) functions DO NOT propagate shadow.
diff --git a/test/msan/origin-store-long.cc b/test/msan/origin-store-long.cc
index a7c2b7a7d578..5c9fe04b7203 100644
--- a/test/msan/origin-store-long.cc
+++ b/test/msan/origin-store-long.cc
@@ -1,7 +1,7 @@
// Check that 8-byte store updates origin for the full store range.
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O0 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O0 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out && FileCheck %s < %t.out
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O2 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O2 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out && FileCheck %s < %t.out
#include <sanitizer/msan_interface.h>
diff --git a/test/msan/param_tls_limit.cc b/test/msan/param_tls_limit.cc
index 869afc935773..982ae1ebdc2e 100644
--- a/test/msan/param_tls_limit.cc
+++ b/test/msan/param_tls_limit.cc
@@ -1,9 +1,9 @@
// ParamTLS has limited size. Everything that does not fit is considered fully
// initialized.
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && %run %t
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O0 %s -o %t && %run %t
-// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -m64 -O0 %s -o %t && %run %t
+// RUN: %clangxx_msan -O0 %s -o %t && %run %t
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O0 %s -o %t && %run %t
+// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -O0 %s -o %t && %run %t
#include <sanitizer/msan_interface.h>
#include <assert.h>
diff --git a/test/msan/print_stats.cc b/test/msan/print_stats.cc
index 74943835b367..39af504179d6 100644
--- a/test/msan/print_stats.cc
+++ b/test/msan/print_stats.cc
@@ -1,4 +1,4 @@
-// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -m64 -g %s -o %t
+// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -g %s -o %t
// RUN: %run %t 2>&1 | \
// RUN: FileCheck --check-prefix=CHECK --check-prefix=CHECK-NOSTATS %s
// RUN: MSAN_OPTIONS=print_stats=1 %run %t 2>&1 | \
@@ -6,13 +6,13 @@
// RUN: MSAN_OPTIONS=print_stats=1,atexit=1 %run %t 2>&1 | \
// RUN: FileCheck --check-prefix=CHECK --check-prefix=CHECK-STATS %s
-// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -m64 -g -DPOSITIVE=1 %s -o %t
+// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -g -DPOSITIVE=1 %s -o %t
// RUN: not %run %t 2>&1 | \
// RUN: FileCheck --check-prefix=CHECK --check-prefix=CHECK-NOSTATS %s
// RUN: MSAN_OPTIONS=print_stats=1 not %run %t 2>&1 | \
// RUN: FileCheck --check-prefix=CHECK --check-prefix=CHECK-STATS %s
-// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -m64 -g -DPOSITIVE=1 -mllvm -msan-keep-going=1 %s -o %t
+// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -g -DPOSITIVE=1 -mllvm -msan-keep-going=1 %s -o %t
// RUN: not %run %t 2>&1 | \
// RUN: FileCheck --check-prefix=CHECK --check-prefix=CHECK-NOSTATS --check-prefix=CHECK-KEEPGOING %s
// RUN: MSAN_OPTIONS=print_stats=1 not %run %t 2>&1 | \
diff --git a/test/msan/pthread_getattr_np_deadlock.cc b/test/msan/pthread_getattr_np_deadlock.cc
index 07f19cb61b6c..0f52280856cc 100644
--- a/test/msan/pthread_getattr_np_deadlock.cc
+++ b/test/msan/pthread_getattr_np_deadlock.cc
@@ -1,4 +1,4 @@
-// RUN: %clangxx_msan -m64 -fsanitize-memory-track-origins -O0 %s -o %t && %run %t
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O0 %s -o %t && %run %t
// Regression test for a deadlock in pthread_getattr_np
diff --git a/test/msan/rand_r.cc b/test/msan/rand_r.cc
index d6bdb1deaa68..f40cf9f9632a 100644
--- a/test/msan/rand_r.cc
+++ b/test/msan/rand_r.cc
@@ -1,5 +1,5 @@
-// RUN: %clangxx_msan -m64 -O0 -g %s -o %t && %run %t
-// RUN: %clangxx_msan -m64 -O0 -g -DUNINIT %s -o %t && not %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_msan -O0 -g %s -o %t && %run %t
+// RUN: %clangxx_msan -O0 -g -DUNINIT %s -o %t && not %run %t 2>&1 | FileCheck %s
#include <assert.h>
#include <stdio.h>
diff --git a/test/msan/readdir64.cc b/test/msan/readdir64.cc
index 4f00d1838794..e77ada6ac8f2 100644
--- a/test/msan/readdir64.cc
+++ b/test/msan/readdir64.cc
@@ -1,12 +1,12 @@
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && %run %t
-// RUN: %clangxx_msan -m64 -O1 %s -o %t && %run %t
-// RUN: %clangxx_msan -m64 -O2 %s -o %t && %run %t
-// RUN: %clangxx_msan -m64 -O3 %s -o %t && %run %t
+// RUN: %clangxx_msan -O0 %s -o %t && %run %t
+// RUN: %clangxx_msan -O1 %s -o %t && %run %t
+// RUN: %clangxx_msan -O2 %s -o %t && %run %t
+// RUN: %clangxx_msan -O3 %s -o %t && %run %t
-// RUN: %clangxx_msan -m64 -O0 -D_FILE_OFFSET_BITS=64 %s -o %t && %run %t
-// RUN: %clangxx_msan -m64 -O1 -D_FILE_OFFSET_BITS=64 %s -o %t && %run %t
-// RUN: %clangxx_msan -m64 -O2 -D_FILE_OFFSET_BITS=64 %s -o %t && %run %t
-// RUN: %clangxx_msan -m64 -O3 -D_FILE_OFFSET_BITS=64 %s -o %t && %run %t
+// RUN: %clangxx_msan -O0 -D_FILE_OFFSET_BITS=64 %s -o %t && %run %t
+// RUN: %clangxx_msan -O1 -D_FILE_OFFSET_BITS=64 %s -o %t && %run %t
+// RUN: %clangxx_msan -O2 -D_FILE_OFFSET_BITS=64 %s -o %t && %run %t
+// RUN: %clangxx_msan -O3 -D_FILE_OFFSET_BITS=64 %s -o %t && %run %t
// Test that readdir64 is intercepted as well as readdir.
diff --git a/test/msan/realloc-large-origin.cc b/test/msan/realloc-large-origin.cc
index de39394cbb79..ce25ad8c47fd 100644
--- a/test/msan/realloc-large-origin.cc
+++ b/test/msan/realloc-large-origin.cc
@@ -1,6 +1,6 @@
-// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -m64 -O0 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -O0 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
-// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -m64 -O2 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -O2 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
// This is a regression test: there used to be broken "stored to memory at"
diff --git a/test/msan/realloc-origin.cc b/test/msan/realloc-origin.cc
index 6707cc9049a4..e6893713ea46 100644
--- a/test/msan/realloc-origin.cc
+++ b/test/msan/realloc-origin.cc
@@ -1,6 +1,6 @@
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O0 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O0 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O2 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O2 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
// This test relies on realloc from 100 to 101 being done in-place.
diff --git a/test/msan/report-demangling.cc b/test/msan/report-demangling.cc
index e6d5c27ec85d..fbb6554470f2 100644
--- a/test/msan/report-demangling.cc
+++ b/test/msan/report-demangling.cc
@@ -1,7 +1,7 @@
// Test that function name is mangled in the "created by an allocation" line,
// and demangled in the single-frame "stack trace" that follows.
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O0 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O0 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out && FileCheck %s < %t.out
__attribute__((noinline))
@@ -15,5 +15,5 @@ int main(int argc, char **argv) {
return f();
// CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value
// CHECK: Uninitialized value was created by an allocation of 'x' in the stack frame of function '_Z1fv'
- // CHECK: #0 {{.*}} in f() {{.*}}report-demangling.cc:[[@LINE-10]]
+ // CHECK: #0 {{.*}} in f{{.*}} {{.*}}report-demangling.cc:[[@LINE-10]]
}
diff --git a/test/msan/scandir.cc b/test/msan/scandir.cc
index 571ba4f603d2..8adfe006602a 100644
--- a/test/msan/scandir.cc
+++ b/test/msan/scandir.cc
@@ -1,6 +1,6 @@
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && %run %t %p
-// RUN: %clangxx_msan -m64 -O0 -D_FILE_OFFSET_BITS=64 %s -o %t && %run %t %p
-// RUN: %clangxx_msan -m64 -O3 %s -o %t && %run %t %p
+// RUN: %clangxx_msan -O0 %s -o %t && %run %t %p
+// RUN: %clangxx_msan -O0 -D_FILE_OFFSET_BITS=64 %s -o %t && %run %t %p
+// RUN: %clangxx_msan -O3 %s -o %t && %run %t %p
#include <assert.h>
#include <glob.h>
diff --git a/test/msan/scandir_null.cc b/test/msan/scandir_null.cc
index e7663dc43a74..94ac31a4143b 100644
--- a/test/msan/scandir_null.cc
+++ b/test/msan/scandir_null.cc
@@ -1,6 +1,6 @@
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && %run %t %p
-// RUN: %clangxx_msan -m64 -O0 -D_FILE_OFFSET_BITS=64 %s -o %t && %run %t %p
-// RUN: %clangxx_msan -m64 -O3 %s -o %t && %run %t %p
+// RUN: %clangxx_msan -O0 %s -o %t && %run %t %p
+// RUN: %clangxx_msan -O0 -D_FILE_OFFSET_BITS=64 %s -o %t && %run %t %p
+// RUN: %clangxx_msan -O3 %s -o %t && %run %t %p
#include <assert.h>
#include <glob.h>
diff --git a/test/msan/select.cc b/test/msan/select.cc
index 89de75ebaaef..7b8c34785c23 100644
--- a/test/msan/select.cc
+++ b/test/msan/select.cc
@@ -1,10 +1,10 @@
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O0 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
-// RUN: %clangxx_msan -m64 -O1 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O1 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
-// RUN: %clangxx_msan -m64 -O2 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O2 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
-// RUN: %clangxx_msan -m64 -O3 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O3 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
#include <stdlib.h>
diff --git a/test/msan/setlocale.cc b/test/msan/setlocale.cc
index b7007f78da7c..796f4454e6aa 100644
--- a/test/msan/setlocale.cc
+++ b/test/msan/setlocale.cc
@@ -1,4 +1,4 @@
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && %run %t
+// RUN: %clangxx_msan -O0 %s -o %t && %run %t
#include <assert.h>
#include <locale.h>
diff --git a/test/msan/stack-origin.cc b/test/msan/stack-origin.cc
index c39c3a8cf6d0..e69c072242c5 100644
--- a/test/msan/stack-origin.cc
+++ b/test/msan/stack-origin.cc
@@ -1,19 +1,19 @@
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O0 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
-// RUN: %clangxx_msan -m64 -O1 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O1 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
-// RUN: %clangxx_msan -m64 -O2 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O2 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
-// RUN: %clangxx_msan -m64 -O3 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O3 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O0 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O0 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O1 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O1 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O2 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O2 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O3 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O3 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out
#include <stdlib.h>
diff --git a/test/msan/stack-origin2.cc b/test/msan/stack-origin2.cc
index 0ba57607dadb..6c7428c2dec8 100644
--- a/test/msan/stack-origin2.cc
+++ b/test/msan/stack-origin2.cc
@@ -1,21 +1,21 @@
// Test that on the second entry to a function the origins are still right.
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O0 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
-// RUN: %clangxx_msan -m64 -O1 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O1 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
-// RUN: %clangxx_msan -m64 -O2 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O2 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
-// RUN: %clangxx_msan -m64 -O3 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O3 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O0 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O0 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O1 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O1 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O2 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O2 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O3 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O3 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out
#include <stdlib.h>
diff --git a/test/msan/strlen_of_shadow.cc b/test/msan/strlen_of_shadow.cc
index 8f1b4e1fc6bb..763b3a1c73c0 100644
--- a/test/msan/strlen_of_shadow.cc
+++ b/test/msan/strlen_of_shadow.cc
@@ -1,4 +1,4 @@
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && %run %t
+// RUN: %clangxx_msan -O0 %s -o %t && %run %t
// Check that strlen() and similar intercepted functions can be called on shadow
// memory.
@@ -13,6 +13,10 @@ const char *mem_to_shadow(const char *p) {
return (char *)((uintptr_t)p & ~0x400000000000ULL);
#elif defined (__mips64)
return (char *)((uintptr_t)p & ~0x4000000000ULL);
+#elif defined(__powerpc64__)
+#define LINEARIZE_MEM(mem) \
+ (((uintptr_t)(mem) & ~0x200000000000ULL) ^ 0x100000000000ULL)
+ return (char *)(LINEARIZE_MEM(p) + 0x080000000000ULL);
#endif
}
diff --git a/test/msan/strxfrm.cc b/test/msan/strxfrm.cc
index b930a6af69c4..9a30d03c33ae 100644
--- a/test/msan/strxfrm.cc
+++ b/test/msan/strxfrm.cc
@@ -1,4 +1,4 @@
-// RUN: %clangxx_msan -m64 -O0 -g %s -o %t && %run %t
+// RUN: %clangxx_msan -O0 -g %s -o %t && %run %t
#include <assert.h>
#include <sanitizer/msan_interface.h>
diff --git a/test/msan/sync_lock_set_and_test.cc b/test/msan/sync_lock_set_and_test.cc
index b6d344a61340..11fd14fae0f1 100644
--- a/test/msan/sync_lock_set_and_test.cc
+++ b/test/msan/sync_lock_set_and_test.cc
@@ -1,4 +1,4 @@
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && %run %t
+// RUN: %clangxx_msan -O0 %s -o %t && %run %t
int main(void) {
int i;
diff --git a/test/msan/textdomain.cc b/test/msan/textdomain.cc
index 47e991e8c16b..760debd68c33 100644
--- a/test/msan/textdomain.cc
+++ b/test/msan/textdomain.cc
@@ -1,4 +1,4 @@
-// RUN: %clangxx_msan -m64 -O0 -g %s -o %t && %run %t
+// RUN: %clangxx_msan -O0 -g %s -o %t && %run %t
#include <libintl.h>
#include <stdio.h>
diff --git a/test/msan/times.cc b/test/msan/times.cc
index a042f548dc0c..7c81884118bc 100644
--- a/test/msan/times.cc
+++ b/test/msan/times.cc
@@ -1,4 +1,4 @@
-// RUN: %clangxx_msan -m64 -O0 -g %s -o %t && %run %t
+// RUN: %clangxx_msan -O0 -g %s -o %t && %run %t
#include <assert.h>
#include <stdlib.h>
diff --git a/test/msan/tls_reuse.cc b/test/msan/tls_reuse.cc
index e024a5a8d13f..78a328fa3ce0 100644
--- a/test/msan/tls_reuse.cc
+++ b/test/msan/tls_reuse.cc
@@ -1,4 +1,4 @@
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && %run %t
+// RUN: %clangxx_msan -O0 %s -o %t && %run %t
// Check that when TLS block is reused between threads, its shadow is cleaned.
diff --git a/test/msan/tzset.cc b/test/msan/tzset.cc
index ed61d7bcc449..05915e047e15 100644
--- a/test/msan/tzset.cc
+++ b/test/msan/tzset.cc
@@ -1,4 +1,4 @@
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && %run %t
+// RUN: %clangxx_msan -O0 %s -o %t && %run %t
#include <stdlib.h>
#include <string.h>
diff --git a/test/msan/unaligned_read_origin.cc b/test/msan/unaligned_read_origin.cc
index e5618efbde24..b04800a139f2 100644
--- a/test/msan/unaligned_read_origin.cc
+++ b/test/msan/unaligned_read_origin.cc
@@ -1,6 +1,6 @@
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O0 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O0 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out && FileCheck %s < %t.out
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O3 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O3 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out && FileCheck %s < %t.out
#include <sanitizer/msan_interface.h>
diff --git a/test/msan/unpoison_string.cc b/test/msan/unpoison_string.cc
index ac947b9cf6fd..84d952833539 100644
--- a/test/msan/unpoison_string.cc
+++ b/test/msan/unpoison_string.cc
@@ -1,6 +1,6 @@
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O0 %s -o %t
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O0 %s -o %t
// RUN: %run %t
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O3 %s -o %t
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O3 %s -o %t
// RUN: %run %t
#include <assert.h>
diff --git a/test/msan/use-after-free.cc b/test/msan/use-after-free.cc
index 869bad98e455..c505124479b0 100644
--- a/test/msan/use-after-free.cc
+++ b/test/msan/use-after-free.cc
@@ -1,19 +1,19 @@
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O0 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
-// RUN: %clangxx_msan -m64 -O1 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O1 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
-// RUN: %clangxx_msan -m64 -O2 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O2 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
-// RUN: %clangxx_msan -m64 -O3 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -O3 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O0 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O0 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O1 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O1 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O2 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O2 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out
-// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O3 %s -o %t && not %run %t >%t.out 2>&1
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -O3 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out
#include <stdlib.h>
diff --git a/test/msan/vector_cvt.cc b/test/msan/vector_cvt.cc
index bd9b6a8b8000..633a8b15c444 100644
--- a/test/msan/vector_cvt.cc
+++ b/test/msan/vector_cvt.cc
@@ -1,5 +1,6 @@
-// RUN: %clangxx_msan -m64 -O0 %s -o %t && %run %t
-// RUN: %clangxx_msan -DPOSITIVE -m64 -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_msan -O0 %s -o %t && %run %t
+// RUN: %clangxx_msan -DPOSITIVE -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
+// REQUIRES: x86_64-supported-target
#include <emmintrin.h>
diff --git a/test/msan/vector_select.cc b/test/msan/vector_select.cc
index afeb1ad50c8b..0cf116497801 100644
--- a/test/msan/vector_select.cc
+++ b/test/msan/vector_select.cc
@@ -1,5 +1,5 @@
-// RUN: %clangxx_msan -m64 -O0 %s -c -o %t
-// RUN: %clangxx_msan -m64 -O3 %s -c -o %t
+// RUN: %clangxx_msan -O0 %s -c -o %t
+// RUN: %clangxx_msan -O3 %s -c -o %t
// Regression test for MemorySanitizer instrumentation of a select instruction
// with vector arguments.
@@ -11,7 +11,7 @@ __m128d select(bool b, __m128d c, __m128d d)
{
return b ? c : d;
}
-#elif defined (__mips64)
+#elif defined (__mips64) || defined (__powerpc64__)
typedef double __w64d __attribute__ ((vector_size(16)));
__w64d select(bool b, __w64d c, __w64d d)