[llvm-commits] [llvm] r168887 - /llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp
Evgeniy Stepanov
eugeni.stepanov at gmail.com
Thu Nov 29 06:44:00 PST 2012
Author: eugenis
Date: Thu Nov 29 08:44:00 2012
New Revision: 168887
URL: http://llvm.org/viewvc/llvm-project?rev=168887&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp
Modified: llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp?rev=168887&r1=168886&r2=168887&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp Thu Nov 29 08:44:00 2012
@@ -842,15 +842,16 @@
///
/// 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);
}
More information about the llvm-commits
mailing list