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 | f433cecf9695b5ef7a585ebcee65bae1d6e459b5 (patch) | |
tree | a896222a8e5725e8b0694f9393fcd75186b2bad6 /llvm/lib | |
parent | 93aefa5f2ce85f13408a18af1bbc7cff8504fdb3 (diff) | |
download | bcm5719-llvm-f433cecf9695b5ef7a585ebcee65bae1d6e459b5.tar.gz bcm5719-llvm-f433cecf9695b5ef7a585ebcee65bae1d6e459b5.zip |
[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.
llvm-svn: 168887
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp index d745a0c47af..e74ff5c57c3 100644 --- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp +++ b/llvm/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); } |