diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2014-06-09 14:29:34 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2014-06-09 14:29:34 +0000 |
commit | 24f5e55fce66d8c824aadf8dddfa256c040ea68e (patch) | |
tree | a5545ab6bdd68f1a33758b8abfc22eaad0826f7b /lib/Transforms | |
parent | 5b7ac8ba184aa020fcda6c0e787a2077edd882d2 (diff) | |
download | llvm-24f5e55fce66d8c824aadf8dddfa256c040ea68e.tar.gz llvm-24f5e55fce66d8c824aadf8dddfa256c040ea68e.tar.bz2 llvm-24f5e55fce66d8c824aadf8dddfa256c040ea68e.tar.xz |
[msan] Workaround for invalid origins in shufflevector.
Makes origin propagation ignore literal undef operands, and,
in general, any operand we don't have origin for.
https://code.google.com/p/memory-sanitizer/issues/detail?id=56
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210472 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Instrumentation/MemorySanitizer.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/lib/Transforms/Instrumentation/MemorySanitizer.cpp index 93b09d32e4..e890943c6a 100644 --- a/lib/Transforms/Instrumentation/MemorySanitizer.cpp +++ b/lib/Transforms/Instrumentation/MemorySanitizer.cpp @@ -1302,10 +1302,14 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> { if (!Origin) { Origin = OpOrigin; } else { - Value *FlatShadow = MSV->convertToShadowTyNoVec(OpShadow, IRB); - Value *Cond = IRB.CreateICmpNE(FlatShadow, - MSV->getCleanShadow(FlatShadow)); - Origin = IRB.CreateSelect(Cond, OpOrigin, Origin); + Constant *ConstOrigin = dyn_cast<Constant>(OpOrigin); + // No point in adding something that might result in 0 origin value. + if (!ConstOrigin || !ConstOrigin->isNullValue()) { + Value *FlatShadow = MSV->convertToShadowTyNoVec(OpShadow, IRB); + Value *Cond = + IRB.CreateICmpNE(FlatShadow, MSV->getCleanShadow(FlatShadow)); + Origin = IRB.CreateSelect(Cond, OpOrigin, Origin); + } } } return *this; |