mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 11:42:57 +01:00
[msan] Emit checks for constant shadow values under an experimental flag.
Does not change the default behavior. llvm-svn: 220457
This commit is contained in:
parent
e3b5e8b37a
commit
a5a5d92c17
@ -199,6 +199,13 @@ static cl::opt<bool> ClWrapIndirectCallsFast("msan-wrap-indirect-calls-fast",
|
||||
cl::desc("Do not wrap indirect calls with target in the same module"),
|
||||
cl::Hidden, cl::init(true));
|
||||
|
||||
// This is an experiment to enable handling of cases where shadow is a non-zero
|
||||
// compile-time constant. For some unexplainable reason they were silently
|
||||
// ignored in the instrumentation.
|
||||
static cl::opt<bool> ClCheckConstantShadow("msan-check-constant-shadow",
|
||||
cl::desc("Insert checks for constant shadow values"),
|
||||
cl::Hidden, cl::init(false));
|
||||
|
||||
namespace {
|
||||
|
||||
/// \brief An instrumentation pass implementing detection of uninitialized
|
||||
@ -563,6 +570,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
|
||||
// TODO(eugenis): handle non-zero constant shadow by inserting an
|
||||
// unconditional check (can not simply fail compilation as this could
|
||||
// be in the dead code).
|
||||
if (!ClCheckConstantShadow)
|
||||
if (isa<Constant>(ConvertedShadow)) return;
|
||||
unsigned TypeSizeInBits =
|
||||
MS.DL->getTypeSizeInBits(ConvertedShadow->getType());
|
||||
@ -619,7 +627,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
|
||||
DEBUG(dbgs() << " SHAD0 : " << *Shadow << "\n");
|
||||
Value *ConvertedShadow = convertToShadowTyNoVec(Shadow, IRB);
|
||||
DEBUG(dbgs() << " SHAD1 : " << *ConvertedShadow << "\n");
|
||||
// See the comment in materializeStores().
|
||||
// See the comment in storeOrigin().
|
||||
if (!ClCheckConstantShadow)
|
||||
if (isa<Constant>(ConvertedShadow)) return;
|
||||
unsigned TypeSizeInBits =
|
||||
MS.DL->getTypeSizeInBits(ConvertedShadow->getType());
|
||||
|
Loading…
Reference in New Issue
Block a user