summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
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
commitcb5bdffc4e8fc714911e660e756cdce442443fc4 (patch)
tree388f59326c5072f3fa9faf67f97cb11a81785abe /llvm/lib/Transforms
parent70fcec46e9767f41e3d8a8fc6480e54dc8ef6502 (diff)
downloadbcm5719-llvm-cb5bdffc4e8fc714911e660e756cdce442443fc4.tar.gz
bcm5719-llvm-cb5bdffc4e8fc714911e660e756cdce442443fc4.zip
[msan] Propagate condition origin in select instruction.
llvm-svn: 195349
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
index d547adc86e1..f2e1ab7513c 100644
--- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ b/llvm/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()))));
}
}
OpenPOWER on IntegriCloud