216 changes: 121 additions & 95 deletions llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
///
//===----------------------------------------------------------------------===//

#include "llvm/Transforms/Instrumentation/MemorySanitizer.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DepthFirstIterator.h"
Expand All @@ -149,7 +150,6 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Triple.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/IR/Argument.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
Expand Down Expand Up @@ -187,6 +187,7 @@
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/Instrumentation.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Transforms/Utils/ModuleUtils.h"
#include <algorithm>
#include <cassert>
Expand Down Expand Up @@ -320,7 +321,6 @@ static cl::opt<unsigned long long> ClOriginBase("msan-origin-base",
cl::desc("Define custom MSan OriginBase"),
cl::Hidden, cl::init(0));

static const char *const kMsanModuleCtorName = "msan.module_ctor";
static const char *const kMsanInitName = "__msan_init";

namespace {
Expand Down Expand Up @@ -446,19 +446,16 @@ static const PlatformMemoryMapParams NetBSD_X86_MemoryMapParams = {

namespace {

/// An instrumentation pass implementing detection of uninitialized
/// reads.
/// Instrument functions of a module to detect uninitialized reads.
///
/// MemorySanitizer: instrument the code in module to find
/// uninitialized reads.
class MemorySanitizer : public FunctionPass {
/// Instantiating MemorySanitizer inserts the msan runtime library API function
/// declarations into the module if they don't exist already. Instantiating
/// ensures the __msan_init function is in the list of global constructors for
/// the module.
class MemorySanitizer {
public:
// Pass identification, replacement for typeid.
static char ID;

MemorySanitizer(int TrackOrigins = 0, bool Recover = false,
bool EnableKmsan = false)
: FunctionPass(ID) {
MemorySanitizer(Module &M, int TrackOrigins = 0, bool Recover = false,
bool EnableKmsan = false) {
this->CompileKernel =
ClEnableKmsan.getNumOccurrences() > 0 ? ClEnableKmsan : EnableKmsan;
if (ClTrackOrigins.getNumOccurrences() > 0)
Expand All @@ -468,15 +465,16 @@ class MemorySanitizer : public FunctionPass {
this->Recover = ClKeepGoing.getNumOccurrences() > 0
? ClKeepGoing
: (this->CompileKernel | Recover);
initializeModule(M);
}
StringRef getPassName() const override { return "MemorySanitizer"; }

void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<TargetLibraryInfoWrapperPass>();
}
// MSan cannot be moved or copied because of MapParams.
MemorySanitizer(MemorySanitizer &&) = delete;
MemorySanitizer &operator=(MemorySanitizer &&) = delete;
MemorySanitizer(const MemorySanitizer &) = delete;
MemorySanitizer &operator=(const MemorySanitizer &) = delete;

bool runOnFunction(Function &F) override;
bool doInitialization(Module &M) override;
bool sanitizeFunction(Function &F, TargetLibraryInfo &TLI);

private:
friend struct MemorySanitizerVisitor;
Expand All @@ -485,13 +483,13 @@ class MemorySanitizer : public FunctionPass {
friend struct VarArgAArch64Helper;
friend struct VarArgPowerPC64Helper;

void initializeModule(Module &M);
void initializeCallbacks(Module &M);
void createKernelApi(Module &M);
void createUserspaceApi(Module &M);

/// True if we're compiling the Linux kernel.
bool CompileKernel;

/// Track origins (allocation points) of uninitialized values.
int TrackOrigins;
bool Recover;
Expand Down Expand Up @@ -588,25 +586,61 @@ class MemorySanitizer : public FunctionPass {

/// An empty volatile inline asm that prevents callback merge.
InlineAsm *EmptyAsm;
};

Function *MsanCtorFunction;
/// A legacy function pass for msan instrumentation.
///
/// Instruments functions to detect unitialized reads.
struct MemorySanitizerLegacyPass : public FunctionPass {
// Pass identification, replacement for typeid.
static char ID;

MemorySanitizerLegacyPass(int TrackOrigins = 0, bool Recover = false,
bool EnableKmsan = false)
: FunctionPass(ID), TrackOrigins(TrackOrigins), Recover(Recover),
EnableKmsan(EnableKmsan) {}
StringRef getPassName() const override { return "MemorySanitizerLegacyPass"; }

void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<TargetLibraryInfoWrapperPass>();
}

bool runOnFunction(Function &F) override {
return MSan->sanitizeFunction(
F, getAnalysis<TargetLibraryInfoWrapperPass>().getTLI());
}
bool doInitialization(Module &M) override;

Optional<MemorySanitizer> MSan;
int TrackOrigins;
bool Recover;
bool EnableKmsan;
};

} // end anonymous namespace

char MemorySanitizer::ID = 0;
PreservedAnalyses MemorySanitizerPass::run(Function &F,
FunctionAnalysisManager &FAM) {
MemorySanitizer Msan(*F.getParent(), TrackOrigins, Recover, EnableKmsan);
if (Msan.sanitizeFunction(F, FAM.getResult<TargetLibraryAnalysis>(F)))
return PreservedAnalyses::none();
return PreservedAnalyses::all();
}

INITIALIZE_PASS_BEGIN(
MemorySanitizer, "msan",
"MemorySanitizer: detects uninitialized reads.", false, false)
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
INITIALIZE_PASS_END(
MemorySanitizer, "msan",
"MemorySanitizer: detects uninitialized reads.", false, false)
char MemorySanitizerLegacyPass::ID = 0;

FunctionPass *llvm::createMemorySanitizerPass(int TrackOrigins, bool Recover,
bool CompileKernel) {
return new MemorySanitizer(TrackOrigins, Recover, CompileKernel);
INITIALIZE_PASS_BEGIN(MemorySanitizerLegacyPass, "msan",
"MemorySanitizer: detects uninitialized reads.", false,
false)
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
INITIALIZE_PASS_END(MemorySanitizerLegacyPass, "msan",
"MemorySanitizer: detects uninitialized reads.", false,
false)

FunctionPass *llvm::createMemorySanitizerLegacyPassPass(int TrackOrigins,
bool Recover,
bool CompileKernel) {
return new MemorySanitizerLegacyPass(TrackOrigins, Recover, CompileKernel);
}

/// Create a non-const global initialized with the given string.
Expand Down Expand Up @@ -683,6 +717,14 @@ void MemorySanitizer::createKernelApi(Module &M) {
"__msan_unpoison_alloca", IRB.getVoidTy(), IRB.getInt8PtrTy(), IntptrTy);
}

static Constant *getOrInsertGlobal(Module &M, StringRef Name, Type *Ty) {
return M.getOrInsertGlobal(Name, Ty, [&] {
return new GlobalVariable(M, Ty, false, GlobalVariable::ExternalLinkage,
nullptr, Name, nullptr,
GlobalVariable::InitialExecTLSModel);
});
}

/// Insert declarations for userspace-specific functions and globals.
void MemorySanitizer::createUserspaceApi(Module &M) {
IRBuilder<> IRB(*C);
Expand All @@ -694,42 +736,31 @@ void MemorySanitizer::createUserspaceApi(Module &M) {
WarningFn = M.getOrInsertFunction(WarningFnName, IRB.getVoidTy());

// Create the global TLS variables.
RetvalTLS = new GlobalVariable(
M, ArrayType::get(IRB.getInt64Ty(), kRetvalTLSSize / 8), false,
GlobalVariable::ExternalLinkage, nullptr, "__msan_retval_tls", nullptr,
GlobalVariable::InitialExecTLSModel);

RetvalOriginTLS = new GlobalVariable(
M, OriginTy, false, GlobalVariable::ExternalLinkage, nullptr,
"__msan_retval_origin_tls", nullptr, GlobalVariable::InitialExecTLSModel);

ParamTLS = new GlobalVariable(
M, ArrayType::get(IRB.getInt64Ty(), kParamTLSSize / 8), false,
GlobalVariable::ExternalLinkage, nullptr, "__msan_param_tls", nullptr,
GlobalVariable::InitialExecTLSModel);

ParamOriginTLS = new GlobalVariable(
M, ArrayType::get(OriginTy, kParamTLSSize / 4), false,
GlobalVariable::ExternalLinkage, nullptr, "__msan_param_origin_tls",
nullptr, GlobalVariable::InitialExecTLSModel);

VAArgTLS = new GlobalVariable(
M, ArrayType::get(IRB.getInt64Ty(), kParamTLSSize / 8), false,
GlobalVariable::ExternalLinkage, nullptr, "__msan_va_arg_tls", nullptr,
GlobalVariable::InitialExecTLSModel);

VAArgOriginTLS = new GlobalVariable(
M, ArrayType::get(OriginTy, kParamTLSSize / 4), false,
GlobalVariable::ExternalLinkage, nullptr, "__msan_va_arg_origin_tls",
nullptr, GlobalVariable::InitialExecTLSModel);

VAArgOverflowSizeTLS = new GlobalVariable(
M, IRB.getInt64Ty(), false, GlobalVariable::ExternalLinkage, nullptr,
"__msan_va_arg_overflow_size_tls", nullptr,
GlobalVariable::InitialExecTLSModel);
OriginTLS = new GlobalVariable(
M, IRB.getInt32Ty(), false, GlobalVariable::ExternalLinkage, nullptr,
"__msan_origin_tls", nullptr, GlobalVariable::InitialExecTLSModel);
RetvalTLS =
getOrInsertGlobal(M, "__msan_retval_tls",
ArrayType::get(IRB.getInt64Ty(), kRetvalTLSSize / 8));

RetvalOriginTLS = getOrInsertGlobal(M, "__msan_retval_origin_tls", OriginTy);

ParamTLS =
getOrInsertGlobal(M, "__msan_param_tls",
ArrayType::get(IRB.getInt64Ty(), kParamTLSSize / 8));

ParamOriginTLS =
getOrInsertGlobal(M, "__msan_param_origin_tls",
ArrayType::get(OriginTy, kParamTLSSize / 4));

VAArgTLS =
getOrInsertGlobal(M, "__msan_va_arg_tls",
ArrayType::get(IRB.getInt64Ty(), kParamTLSSize / 8));

VAArgOriginTLS =
getOrInsertGlobal(M, "__msan_va_arg_origin_tls",
ArrayType::get(OriginTy, kParamTLSSize / 4));

VAArgOverflowSizeTLS =
getOrInsertGlobal(M, "__msan_va_arg_overflow_size_tls", IRB.getInt64Ty());
OriginTLS = getOrInsertGlobal(M, "__msan_origin_tls", IRB.getInt32Ty());

for (size_t AccessSizeIndex = 0; AccessSizeIndex < kNumberOfAccessSizes;
AccessSizeIndex++) {
Expand Down Expand Up @@ -808,9 +839,7 @@ Value *MemorySanitizer::getKmsanShadowOriginAccessFn(bool isStore, int size) {
}

/// Module-level initialization.
///
/// inserts a call to __msan_init to the module's constructor list.
bool MemorySanitizer::doInitialization(Module &M) {
void MemorySanitizer::initializeModule(Module &M) {
auto &DL = M.getDataLayout();

bool ShadowPassed = ClShadowBase.getNumOccurrences() > 0;
Expand Down Expand Up @@ -884,27 +913,26 @@ bool MemorySanitizer::doInitialization(Module &M) {
OriginStoreWeights = MDBuilder(*C).createBranchWeights(1, 1000);

if (!CompileKernel) {
std::tie(MsanCtorFunction, std::ignore) =
createSanitizerCtorAndInitFunctions(M, kMsanModuleCtorName,
kMsanInitName,
/*InitArgTypes=*/{},
/*InitArgs=*/{});
if (ClWithComdat) {
Comdat *MsanCtorComdat = M.getOrInsertComdat(kMsanModuleCtorName);
MsanCtorFunction->setComdat(MsanCtorComdat);
appendToGlobalCtors(M, MsanCtorFunction, 0, MsanCtorFunction);
} else {
appendToGlobalCtors(M, MsanCtorFunction, 0);
}
getOrCreateInitFunction(M, kMsanInitName);

if (TrackOrigins)
new GlobalVariable(M, IRB.getInt32Ty(), true, GlobalValue::WeakODRLinkage,
IRB.getInt32(TrackOrigins), "__msan_track_origins");
M.getOrInsertGlobal("__msan_track_origins", IRB.getInt32Ty(), [&] {
return new GlobalVariable(
M, IRB.getInt32Ty(), true, GlobalValue::WeakODRLinkage,
IRB.getInt32(TrackOrigins), "__msan_track_origins");
});

if (Recover)
new GlobalVariable(M, IRB.getInt32Ty(), true, GlobalValue::WeakODRLinkage,
IRB.getInt32(Recover), "__msan_keep_going");
}
M.getOrInsertGlobal("__msan_keep_going", IRB.getInt32Ty(), [&] {
return new GlobalVariable(M, IRB.getInt32Ty(), true,
GlobalValue::WeakODRLinkage,
IRB.getInt32(Recover), "__msan_keep_going");
});
}
}

bool MemorySanitizerLegacyPass::doInitialization(Module &M) {
MSan.emplace(M, TrackOrigins, Recover, EnableKmsan);
return true;
}

Expand Down Expand Up @@ -985,8 +1013,9 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
SmallVector<ShadowOriginAndInsertPoint, 16> InstrumentationList;
SmallVector<StoreInst *, 16> StoreList;

MemorySanitizerVisitor(Function &F, MemorySanitizer &MS)
: F(F), MS(MS), VAHelper(CreateVarArgHelper(F, MS, *this)) {
MemorySanitizerVisitor(Function &F, MemorySanitizer &MS,
const TargetLibraryInfo &TLI)
: F(F), MS(MS), VAHelper(CreateVarArgHelper(F, MS, *this)), TLI(&TLI) {
bool SanitizeFunction = F.hasFnAttribute(Attribute::SanitizeMemory);
InsertChecks = SanitizeFunction;
PropagateShadow = SanitizeFunction;
Expand All @@ -995,7 +1024,6 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
// FIXME: Consider using SpecialCaseList to specify a list of functions that
// must always return fully initialized values. For now, we hardcode "main".
CheckReturnValue = SanitizeFunction && (F.getName() == "main");
TLI = &MS.getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();

MS.initializeCallbacks(*F.getParent());
if (MS.CompileKernel)
Expand Down Expand Up @@ -4430,10 +4458,8 @@ static VarArgHelper *CreateVarArgHelper(Function &Func, MemorySanitizer &Msan,
return new VarArgNoOpHelper(Func, Msan, Visitor);
}

bool MemorySanitizer::runOnFunction(Function &F) {
if (!CompileKernel && (&F == MsanCtorFunction))
return false;
MemorySanitizerVisitor Visitor(F, *this);
bool MemorySanitizer::sanitizeFunction(Function &F, TargetLibraryInfo &TLI) {
MemorySanitizerVisitor Visitor(F, *this, TLI);

// Clear out readonly/readnone attributes.
AttrBuilder B;
Expand Down
21 changes: 21 additions & 0 deletions llvm/lib/Transforms/Utils/ModuleUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,27 @@ std::pair<Function *, Function *> llvm::createSanitizerCtorAndInitFunctions(
return std::make_pair(Ctor, InitFunction);
}

Function *llvm::getOrCreateInitFunction(Module &M, StringRef Name) {
assert(!Name.empty() && "Expected init function name");
if (Function *F = M.getFunction(Name)) {
if (F->arg_size() != 0 ||
F->getReturnType() != Type::getVoidTy(M.getContext())) {
std::string Err;
raw_string_ostream Stream(Err);
Stream << "Sanitizer interface function defined with wrong type: " << *F;
report_fatal_error(Err);
}
return F;
}
Function *F = checkSanitizerInterfaceFunction(M.getOrInsertFunction(
Name, AttributeList(), Type::getVoidTy(M.getContext())));
F->setLinkage(Function::ExternalLinkage);

appendToGlobalCtors(M, F, 0);

return F;
}

void llvm::filterDeadComdatFunctions(
Module &M, SmallVectorImpl<Function *> &DeadComdatFunctions) {
// Build a map from the comdat to the number of entries in that comdat we
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
; RUN: opt < %s -S -passes=msan 2>&1 | FileCheck %s
; RUN: opt < %s -msan -S | FileCheck %s

target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
; RUN: opt < %s -S -passes=msan 2>&1 | FileCheck %s
; RUN: opt < %s -msan -S | FileCheck %s

target datalayout = "E-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
; RUN: opt < %s -S -passes=msan 2>&1 | FileCheck %s
; RUN: opt < %s -msan -S | FileCheck %s

target datalayout = "e-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
; RUN: opt < %s -S -passes=msan 2>&1 | FileCheck %s
; RUN: opt < %s -msan -S | FileCheck %s

target datalayout = "E-m:e-i64:64-n32:64"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
; RUN: opt < %s -S -passes=msan 2>&1 | FileCheck %s
; RUN: opt < %s -msan -S | FileCheck %s

target datalayout = "e-m:e-i64:64-n32:64"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
; RUN: opt < %s -msan-check-access-address=0 -S 2>&1 -passes=msan | FileCheck \
; RUN: %s
; RUN: opt < %s -msan -msan-check-access-address=0 -S 2>&1 | FileCheck %s

; Test that MSan doesn't generate code overflowing __msan_va_arg_tls when too many arguments are
Expand Down
1 change: 1 addition & 0 deletions llvm/test/Instrumentation/MemorySanitizer/X86/vararg.ll
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1
; RUN: opt < %s -msan -msan-check-access-address=0 -S
; Test that code using va_start can be compiled on i386.

Expand Down
6 changes: 6 additions & 0 deletions llvm/test/Instrumentation/MemorySanitizer/X86/vararg_call.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
; RUN: %s
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=1 -S \
; RUN: -passes=msan 2>&1 | FileCheck %s "--check-prefixes=CHECK,CHECK-ORIGIN"
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck %s --check-prefixes=CHECK,CHECK-ORIGIN
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=2 -S \
; RUN: -passes=msan 2>&1 | FileCheck %s "--check-prefixes=CHECK,CHECK-ORIGIN"
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=2 -S | FileCheck %s --check-prefixes=CHECK,CHECK-ORIGIN

; Test that shadow and origin are stored for variadic function params.
Expand Down
10 changes: 10 additions & 0 deletions llvm/test/Instrumentation/MemorySanitizer/alloca.ll
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
; RUN: %s "--check-prefixes=CHECK,INLINE"
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s --check-prefixes=CHECK,INLINE
; RUN: opt < %s -msan-check-access-address=0 -msan-poison-stack-with-call=1 -S \
; RUN: -passes=msan 2>&1 | FileCheck %s "--check-prefixes=CHECK,CALL"
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-poison-stack-with-call=1 -S | FileCheck %s --check-prefixes=CHECK,CALL
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=1 -S \
; RUN: -passes=msan 2>&1 | FileCheck %s "--check-prefixes=CHECK,ORIGIN"
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck %s --check-prefixes=CHECK,ORIGIN
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=2 -S \
; RUN: -passes=msan 2>&1 | FileCheck %s "--check-prefixes=CHECK,ORIGIN"
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=2 -S | FileCheck %s --check-prefixes=CHECK,ORIGIN
; RUN: opt < %s -msan-kernel=1 -S -passes=msan 2>&1 | FileCheck %s \
; RUN: "--check-prefixes=CHECK,KMSAN"
; RUN: opt < %s -msan -msan-kernel=1 -S | FileCheck %s --check-prefixes=CHECK,KMSAN

target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
Expand Down
5 changes: 5 additions & 0 deletions llvm/test/Instrumentation/MemorySanitizer/array_types.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
; RUN: %s
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=1 -S \
; RUN: -passes=msan 2>&1 | FileCheck -check-prefix=CHECK \
; RUN: -check-prefix=CHECK-ORIGINS %s --allow-empty
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck -check-prefix=CHECK -check-prefix=CHECK-ORIGINS %s

target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
Expand Down
6 changes: 6 additions & 0 deletions llvm/test/Instrumentation/MemorySanitizer/atomics.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
; RUN: %s
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=1 -S \
; RUN: -passes=msan 2>&1 | FileCheck %s
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck %s
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=2 -S \
; RUN: -passes=msan 2>&1 | FileCheck %s
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=2 -S | FileCheck %s

target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
Expand Down
2 changes: 2 additions & 0 deletions llvm/test/Instrumentation/MemorySanitizer/byval-alignment.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
; Test that copy alignment for byval arguments is limited by param-tls slot alignment.

; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
; RUN: %s
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s

target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
; RUN: opt < %s -msan-check-access-address=0 -msan-check-constant-shadow=1 \
; RUN: -msan-track-origins=1 -S -passes=msan 2>&1 | FileCheck %s
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-check-constant-shadow=1 -msan-track-origins=1 -S | FileCheck %s

target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
; RUN: opt < %s -msan-check-access-address=1 -S -passes=msan 2>&1 | FileCheck \
; RUN: %s
; RUN: opt < %s -msan -msan-check-access-address=1 -S | FileCheck %s

target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
Expand Down
4 changes: 4 additions & 0 deletions llvm/test/Instrumentation/MemorySanitizer/csr.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
; RUN: %s
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
; RUN: opt < %s -msan-check-access-address=1 -S -passes=msan 2>&1 | FileCheck \
; RUN: %s --check-prefix=ADDR
; RUN: opt < %s -msan -msan-check-access-address=1 -S | FileCheck %s --check-prefix=ADDR
; REQUIRES: x86-registered-target

Expand Down
17 changes: 0 additions & 17 deletions llvm/test/Instrumentation/MemorySanitizer/global_ctors_2to3.ll

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,19 @@
; Test that in with-calls mode there are no calls to __msan_chain_origin - they
; are done from __msan_maybe_store_origin_*.

; RUN: opt < %s -msan-check-access-address=0 \
; RUN: -msan-instrumentation-with-call-threshold=0 -S -passes=msan 2>&1 | \
; RUN: FileCheck %s
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-instrumentation-with-call-threshold=0 -S | FileCheck %s
; RUN: opt < %s -msan-check-access-address=0 \
; RUN: -msan-instrumentation-with-call-threshold=0 -msan-track-origins=1 -S \
; RUN: -passes=msan 2>&1 | FileCheck -check-prefix=CHECK \
; RUN: -check-prefix=CHECK-ORIGINS %s
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-instrumentation-with-call-threshold=0 -msan-track-origins=1 -S | FileCheck -check-prefix=CHECK -check-prefix=CHECK-ORIGINS %s
; RUN: opt < %s -msan-check-access-address=0 \
; RUN: -msan-instrumentation-with-call-threshold=0 -msan-track-origins=2 -S \
; RUN: -passes=msan 2>&1 | FileCheck -check-prefix=CHECK \
; RUN: -check-prefix=CHECK-ORIGINS %s
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-instrumentation-with-call-threshold=0 -msan-track-origins=2 -S | FileCheck -check-prefix=CHECK -check-prefix=CHECK-ORIGINS %s

target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
Expand Down
11 changes: 11 additions & 0 deletions llvm/test/Instrumentation/MemorySanitizer/manual-shadow.ll
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
; Test that the msan layout customization options work as expected
;
; RUN: opt < %s -msan-shadow-base 3735928559 -S -passes=msan 2>&1 | FileCheck \
; RUN: --check-prefix=CHECK-BASE %s
; RUN: opt < %s -msan -msan-shadow-base 3735928559 -S | FileCheck --check-prefix=CHECK-BASE %s
; RUN: opt < %s -msan-shadow-base 3735928559 -msan-and-mask 4294901760 -S \
; RUN: -passes=msan 2>&1 | FileCheck --check-prefix=CHECK-AND %s
; RUN: opt < %s -msan -msan-shadow-base 3735928559 -msan-and-mask 4294901760 -S | FileCheck --check-prefix=CHECK-AND %s
; RUN: opt < %s -msan-shadow-base 3735928559 -msan-xor-mask 48879 -S \
; RUN: -passes=msan 2>&1 | FileCheck --check-prefix=CHECK-XOR %s
; RUN: opt < %s -msan -msan-shadow-base 3735928559 -msan-xor-mask 48879 -S | FileCheck --check-prefix=CHECK-XOR %s
; RUN: opt < %s -msan-shadow-base 3735928559 -msan-xor-mask 48879 \
; RUN: -msan-and-mask 4294901760 -S -passes=msan 2>&1 | FileCheck \
; RUN: --check-prefix=CHECK-XOR-AND %s
; RUN: opt < %s -msan -msan-shadow-base 3735928559 -msan-xor-mask 48879 -msan-and-mask 4294901760 -S | FileCheck --check-prefix=CHECK-XOR-AND %s
; RUN: opt < %s -msan-track-origins 1 -msan-origin-base 1777777 -S -passes=msan\
; RUN: 2>&1 | FileCheck --check-prefix=CHECK-ORIGIN-BASE %s
; RUN: opt < %s -msan -msan-track-origins 1 -msan-origin-base 1777777 -S | FileCheck --check-prefix=CHECK-ORIGIN-BASE %s

target triple = "x86_64-unknown-linux-gnu"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
; RUN: %s
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=1 -S \
; RUN: -passes=msan 2>&1 | FileCheck %s "--check-prefixes=CHECK,CHECK-ORIGIN"
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck %s --check-prefixes=CHECK,CHECK-ORIGIN
; RUN: opt < %s -msan-check-access-address=1 -S -passes=msan 2>&1 | FileCheck \
; RUN: %s --check-prefix=ADDR
; RUN: opt < %s -msan -msan-check-access-address=1 -S | FileCheck %s --check-prefix=ADDR

target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
Expand Down
2 changes: 2 additions & 0 deletions llvm/test/Instrumentation/MemorySanitizer/missing_origin.ll
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=1 -S \
; RUN: -passes=msan 2>&1 | FileCheck %s
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck %s

target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
; Test for handling of asm constraints in MSan instrumentation.
; RUN: opt < %s -msan-kernel=1 -msan-check-access-address=0 \
; RUN: -msan-handle-asm-conservative=0 -S -passes=msan 2>&1 | FileCheck \
; RUN: "-check-prefixes=CHECK,CHECK-NONCONS" %s
; RUN: opt < %s -msan -msan-kernel=1 -msan-check-access-address=0 -msan-handle-asm-conservative=0 -S | FileCheck -check-prefixes=CHECK,CHECK-NONCONS %s
; RUN: opt < %s -msan-kernel=1 -msan-check-access-address=0 \
; RUN: -msan-handle-asm-conservative=1 -S -passes=msan 2>&1 | FileCheck \
; RUN: "-check-prefixes=CHECK,CHECK-CONS" %s
; RUN: opt < %s -msan -msan-kernel=1 -msan-check-access-address=0 -msan-handle-asm-conservative=1 -S | FileCheck -check-prefixes=CHECK,CHECK-CONS %s

target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
Expand Down
10 changes: 7 additions & 3 deletions llvm/test/Instrumentation/MemorySanitizer/msan_basic.ll
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
; RUN: -allow-deprecated-dag-overlap %s
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck -allow-deprecated-dag-overlap %s
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=1 -S \
; RUN: -passes=msan 2>&1 | FileCheck -allow-deprecated-dag-overlap \
; RUN: -check-prefix=CHECK -check-prefix=CHECK-ORIGINS %s
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck -allow-deprecated-dag-overlap -check-prefix=CHECK -check-prefix=CHECK-ORIGINS %s

target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; CHECK: @llvm.global_ctors {{.*}} { i32 0, void ()* @msan.module_ctor, i8* null }
; CHECK: @llvm.global_ctors {{.*}} { i32 0, void ()* @__msan_init, i8* null }

; Check the presence and the linkage type of __msan_track_origins and
; other interface symbols.
Expand Down Expand Up @@ -986,5 +991,4 @@ define i8* @MismatchingCallMustTailCall(i32 %a) sanitize_memory {
; CHECK-NEXT: ret i8*


; CHECK-LABEL: define internal void @msan.module_ctor() {
; CHECK: call void @__msan_init()
; CHECK: declare void @__msan_init()
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
; KMSAN instrumentation tests
; RUN: opt < %s -msan-kernel=1 -S -passes=msan 2>&1 | FileCheck %s \
; RUN: -check-prefixes=CHECK
; RUN: opt < %s -msan -msan-kernel=1 -S | FileCheck %s -check-prefixes=CHECK

target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
Expand Down
6 changes: 6 additions & 0 deletions llvm/test/Instrumentation/MemorySanitizer/msan_x86_bts_asm.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
; Test for the conservative assembly handling mode used by KMSAN.
; RUN: opt < %s -msan-kernel=1 -msan-check-access-address=0 \
; RUN: -msan-handle-asm-conservative=0 -S -passes=msan 2>&1 | FileCheck \
; RUN: "-check-prefixes=CHECK,CHECK-NONCONS" %s
; RUN: opt < %s -msan -msan-kernel=1 -msan-check-access-address=0 -msan-handle-asm-conservative=0 -S | FileCheck -check-prefixes=CHECK,CHECK-NONCONS %s
; RUN: opt < %s -msan-kernel=1 -msan-check-access-address=0 \
; RUN: -msan-handle-asm-conservative=1 -S -passes=msan 2>&1 | FileCheck \
; RUN: "-check-prefixes=CHECK,CHECK-CONS" %s
; RUN: opt < %s -msan -msan-kernel=1 -msan-check-access-address=0 -msan-handle-asm-conservative=1 -S | FileCheck -check-prefixes=CHECK,CHECK-CONS %s

target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
; RUN: %s
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=1 -S \
; RUN: -passes=msan 2>&1 | FileCheck -check-prefix=CHECK \
; RUN: -check-prefix=CHECK-ORIGINS %s
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck -check-prefix=CHECK -check-prefix=CHECK-ORIGINS %s
; REQUIRES: x86-registered-target

Expand Down
2 changes: 2 additions & 0 deletions llvm/test/Instrumentation/MemorySanitizer/mul_by_constant.ll
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
; RUN: %s
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s

target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
Expand Down
2 changes: 2 additions & 0 deletions llvm/test/Instrumentation/MemorySanitizer/nosanitize.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
; Verify that calls with !nosanitize are not instrumented by MSan.
; RUN: opt < %s -S -passes=msan 2>&1 | FileCheck %s
; RUN: opt < %s -msan -S | FileCheck %s
; RUN: opt < %s -msan-track-origins=1 -S -passes=msan 2>&1 | FileCheck %s
; RUN: opt < %s -msan -msan-track-origins=1 -S | FileCheck %s
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
Expand Down
6 changes: 6 additions & 0 deletions llvm/test/Instrumentation/MemorySanitizer/origin-alignment.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=1 -S \
; RUN: -passes=msan 2>&1 | FileCheck -check-prefix=CHECK \
; RUN: -check-prefix=CHECK-ORIGINS1 %s
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck -check-prefix=CHECK -check-prefix=CHECK-ORIGINS1 %s
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=2 -S \
; RUN: -passes=msan 2>&1 | FileCheck -check-prefix=CHECK \
; RUN: -check-prefix=CHECK-ORIGINS2 %s
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=2 -S | FileCheck -check-prefix=CHECK -check-prefix=CHECK-ORIGINS2 %s

target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
Expand Down
2 changes: 2 additions & 0 deletions llvm/test/Instrumentation/MemorySanitizer/origin-array.ll
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=2 -S \
; RUN: -passes=msan 2>&1 | FileCheck %s
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=2 -S | FileCheck %s

target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
Expand Down
1 change: 1 addition & 0 deletions llvm/test/Instrumentation/MemorySanitizer/pr32842.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
; Regression test for https://bugs.llvm.org/show_bug.cgi?id=32842
;
; RUN: opt < %s -S -passes=msan 2>&1 | FileCheck %s
; RUN: opt < %s -msan -S | FileCheck %s
;target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
Expand Down
2 changes: 2 additions & 0 deletions llvm/test/Instrumentation/MemorySanitizer/return_from_main.ll
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
; RUN: %s
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=1 -S \
; RUN: -passes=msan 2>&1 | FileCheck %s
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck %s

target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
Expand Down
8 changes: 8 additions & 0 deletions llvm/test/Instrumentation/MemorySanitizer/store-origin.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=1 -S \
; RUN: -passes=msan 2>&1 | FileCheck \
; RUN: "-check-prefixes=CHECK,CHECK-MSAN,CHECK-ORIGINS1" %s
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck -check-prefixes=CHECK,CHECK-MSAN,CHECK-ORIGINS1 %s
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=2 -S \
; RUN: -passes=msan 2>&1 | FileCheck \
; RUN: "-check-prefixes=CHECK,CHECK-MSAN,CHECK-ORIGINS2" %s
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=2 -S | FileCheck -check-prefixes=CHECK,CHECK-MSAN,CHECK-ORIGINS2 %s
; RUN: opt < %s -msan-kernel=1 -msan-check-access-address=0 -S -passes=msan \
; RUN: 2>&1 | FileCheck "-check-prefixes=CHECK,CHECK-KMSAN,CHECK-ORIGINS2" %s
; RUN: opt < %s -msan -msan-kernel=1 -msan-check-access-address=0 -S | FileCheck -check-prefixes=CHECK,CHECK-KMSAN,CHECK-ORIGINS2 %s

target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
Expand Down
1 change: 1 addition & 0 deletions llvm/test/Instrumentation/MemorySanitizer/str-nobuiltin.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
; Test marking string functions as nobuiltin in memory sanitizer.
;
; RUN: opt < %s -S -passes=msan 2>&1 | FileCheck %s
; RUN: opt < %s -msan -S | FileCheck %s
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
target triple = "x86_64-unknown-linux-gnu"
Expand Down
1 change: 1 addition & 0 deletions llvm/test/Instrumentation/MemorySanitizer/unreachable.ll
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
; RUN: opt < %s -S -passes=msan 2>&1 | FileCheck %s
; RUN: opt < %s -msan -S | FileCheck %s
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
Expand Down
1 change: 1 addition & 0 deletions llvm/test/Instrumentation/MemorySanitizer/unsized_type.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
; Check that unsized token types used by coroutine intrinsics do not cause
; assertion failures.
; RUN: opt < %s -S 2>&1 -passes=msan | FileCheck %s
; RUN: opt < %s -msan -S 2>&1 | FileCheck %s

target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
Expand Down
2 changes: 2 additions & 0 deletions llvm/test/Instrumentation/MemorySanitizer/vector_arith.ll
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
; RUN: %s
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
; REQUIRES: x86-registered-target

Expand Down
2 changes: 2 additions & 0 deletions llvm/test/Instrumentation/MemorySanitizer/vector_cmp.ll
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
; RUN: %s
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
; REQUIRES: x86-registered-target

Expand Down
2 changes: 2 additions & 0 deletions llvm/test/Instrumentation/MemorySanitizer/vector_cvt.ll
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
; RUN: %s
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
; REQUIRES: x86-registered-target

Expand Down
2 changes: 2 additions & 0 deletions llvm/test/Instrumentation/MemorySanitizer/vector_pack.ll
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
; RUN: %s
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
; REQUIRES: x86-registered-target

Expand Down
2 changes: 2 additions & 0 deletions llvm/test/Instrumentation/MemorySanitizer/vector_shift.ll
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck \
; RUN: %s
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
; REQUIRES: x86-registered-target

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
; RUN: opt < %s -msan-instrumentation-with-call-threshold=0 -S -passes=msan \
; RUN: 2>&1 | FileCheck %s
; RUN: opt < %s -msan -msan-instrumentation-with-call-threshold=0 -S | FileCheck %s

target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
Expand Down Expand Up @@ -82,4 +84,4 @@ define <4 x i32> @test65(<4 x i32> %vec, i65 %idx, i32 %x) sanitize_memory {
; CHECK-NOT: call void @__msan_maybe_warning_
; CHECK: icmp ne i65 %{{.*}}, 0
; CHECK-NOT: call void @__msan_maybe_warning_
; CHECK: ret <4 x i32>
; CHECK: ret <4 x i32>