From a0f6d1651b08254982244e18afcdd513ca34a3ca Mon Sep 17 00:00:00 2001 From: Evgeniy Stepanov Date: Mon, 14 Oct 2013 09:52:09 +0000 Subject: [msan] Fix handling of scalar select of vectors. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192575 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Instrumentation/MemorySanitizer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/Transforms') diff --git a/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/lib/Transforms/Instrumentation/MemorySanitizer.cpp index 65db206..f158cee 100644 --- a/lib/Transforms/Instrumentation/MemorySanitizer.cpp +++ b/lib/Transforms/Instrumentation/MemorySanitizer.cpp @@ -1233,15 +1233,15 @@ struct MemorySanitizerVisitor : public InstVisitor { Value *CreateShadowCast(IRBuilder<> &IRB, Value *V, Type *dstTy) { Type *srcTy = V->getType(); if (dstTy->isIntegerTy() && srcTy->isIntegerTy()) - return IRB.CreateIntCast(V, dstTy, false); + return IRB.CreateIntCast(V, dstTy, true); if (dstTy->isVectorTy() && srcTy->isVectorTy() && dstTy->getVectorNumElements() == srcTy->getVectorNumElements()) - return IRB.CreateIntCast(V, dstTy, false); + return IRB.CreateIntCast(V, dstTy, true); size_t srcSizeInBits = VectorOrPrimitiveTypeSizeInBits(srcTy); size_t dstSizeInBits = VectorOrPrimitiveTypeSizeInBits(dstTy); Value *V1 = IRB.CreateBitCast(V, Type::getIntNTy(*MS.C, srcSizeInBits)); Value *V2 = - IRB.CreateIntCast(V1, Type::getIntNTy(*MS.C, dstSizeInBits), false); + IRB.CreateIntCast(V1, Type::getIntNTy(*MS.C, dstSizeInBits), true); return IRB.CreateBitCast(V2, dstTy); // TODO: handle struct types. } @@ -1899,7 +1899,7 @@ struct MemorySanitizerVisitor : public InstVisitor { } else { // Sa = (sext Sb) | (select b, Sc, Sd) S = IRB.CreateOr( - S, IRB.CreateSExt(getShadow(I.getCondition()), S->getType()), + S, CreateShadowCast(IRB, getShadow(I.getCondition()), S->getType()), "_msprop_select"); } setShadow(&I, S); -- cgit v1.1