diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2012-11-29 14:44:00 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2012-11-29 14:44:00 +0000 |
commit | b096a9d02f1edc59a06258391fe26d3f6cddda07 (patch) | |
tree | eedaaf42bbbb897eb8c099c8385c2ed066852a3d /lib/Transforms/Instrumentation/MemorySanitizer.cpp | |
parent | 35b3df6e31f9aac70fb471d74e39f899dfbd689f (diff) |
[msan] Fix getOriginForNaryOp.
The old version failed on a 3-arg instruction with (-1, 0, 0) shadows (it would
pick the 3rd operand origin irrespective of its shadow).
The new version always picks the origin of the rightmost poisoned operand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168887 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Instrumentation/MemorySanitizer.cpp')
-rw-r--r-- | lib/Transforms/Instrumentation/MemorySanitizer.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/lib/Transforms/Instrumentation/MemorySanitizer.cpp index d745a0c47a..e74ff5c57c 100644 --- a/lib/Transforms/Instrumentation/MemorySanitizer.cpp +++ b/lib/Transforms/Instrumentation/MemorySanitizer.cpp @@ -842,15 +842,16 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> { /// /// This is a general case of origin propagation. For an Nary operation, /// is set to the origin of an argument that is not entirely initialized. + /// If there is more than one such arguments, the rightmost of them is picked. /// It does not matter which one is picked if all arguments are initialized. void setOriginForNaryOp(Instruction &I) { if (!ClTrackOrigins) return; IRBuilder<> IRB(&I); Value *Origin = getOrigin(&I, 0); for (unsigned Op = 1, n = I.getNumOperands(); Op < n; ++Op) { - Value *S = convertToShadowTyNoVec(getShadow(&I, Op - 1), IRB); + Value *S = convertToShadowTyNoVec(getShadow(&I, Op), IRB); Origin = IRB.CreateSelect(IRB.CreateICmpNE(S, getCleanShadow(S)), - Origin, getOrigin(&I, Op)); + getOrigin(&I, Op), Origin); } setOrigin(&I, Origin); } |