summaryrefslogtreecommitdiff
path: root/lib/Transforms/Instrumentation
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2013-11-21 12:00:24 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2013-11-21 12:00:24 +0000
commit52658c9db59f5b04cf45ba96e84b32247163fce3 (patch)
tree70ba9d907029c981149dfc279e2d8681b6378b21 /lib/Transforms/Instrumentation
parent001a93bbcb12823df7e85957819f1f73f762244b (diff)
downloadllvm-52658c9db59f5b04cf45ba96e84b32247163fce3.tar.gz
llvm-52658c9db59f5b04cf45ba96e84b32247163fce3.tar.bz2
llvm-52658c9db59f5b04cf45ba96e84b32247163fce3.tar.xz
[msan] Propagate condition origin in select instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195349 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Instrumentation')
-rw-r--r--lib/Transforms/Instrumentation/MemorySanitizer.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/lib/Transforms/Instrumentation/MemorySanitizer.cpp
index d547adc86e..f2e1ab7513 100644
--- a/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ b/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -2082,13 +2082,20 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
// Origins are always i32, so any vector conditions must be flattened.
// FIXME: consider tracking vector origins for app vectors?
Value *Cond = I.getCondition();
+ Value *CondShadow = getShadow(Cond);
if (Cond->getType()->isVectorTy()) {
- Value *ConvertedShadow = convertToShadowTyNoVec(Cond, IRB);
- Cond = IRB.CreateICmpNE(ConvertedShadow,
- getCleanShadow(ConvertedShadow), "_mso_select");
+ Type *FlatTy = getShadowTyNoVec(Cond->getType());
+ Cond = IRB.CreateICmpNE(IRB.CreateBitCast(Cond, FlatTy),
+ ConstantInt::getNullValue(FlatTy));
+ CondShadow = IRB.CreateICmpNE(IRB.CreateBitCast(CondShadow, FlatTy),
+ ConstantInt::getNullValue(FlatTy));
}
- setOrigin(&I, IRB.CreateSelect(Cond,
- getOrigin(I.getTrueValue()), getOrigin(I.getFalseValue())));
+ // a = select b, c, d
+ // Oa = Sb ? Ob : (b ? Oc : Od)
+ setOrigin(&I, IRB.CreateSelect(
+ CondShadow, getOrigin(I.getCondition()),
+ IRB.CreateSelect(Cond, getOrigin(I.getTrueValue()),
+ getOrigin(I.getFalseValue()))));
}
}