summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils
diff options
context:
space:
mode:
authorMatt Morehouse <mascasa@google.com>2018-09-19 19:37:24 +0000
committerMatt Morehouse <mascasa@google.com>2018-09-19 19:37:24 +0000
commite62fc3d0b6ce923dcbc29eeb6ebc5808e6724f90 (patch)
treee5fadc259b3b063b9ddb6a12d82ce1c5b67a9c81 /llvm/lib/Transforms/Utils
parenta4526d77c9921c86a29889fc09de17f7d5ccb210 (diff)
downloadbcm5719-llvm-e62fc3d0b6ce923dcbc29eeb6ebc5808e6724f90.tar.gz
bcm5719-llvm-e62fc3d0b6ce923dcbc29eeb6ebc5808e6724f90.zip
[InstCombine] Disable strcmp->memcmp transform for MSan.
Summary: The strcmp->memcmp transform can make the resulting memcmp read uninitialized data, which MSan doesn't like. Resolves https://github.com/google/sanitizers/issues/993. Reviewers: eugenis, xbolva00 Reviewed By: eugenis Subscribers: hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D52272 llvm-svn: 342582
Diffstat (limited to 'llvm/lib/Transforms/Utils')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
index 8fa227930b4..3789181a898 100644
--- a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
@@ -171,7 +171,10 @@ static bool canTransformToMemCmp(CallInst *CI, Value *Str, uint64_t Len,
if (!isDereferenceableAndAlignedPointer(Str, 1, APInt(64, Len), DL))
return false;
-
+
+ if (CI->getFunction()->hasFnAttribute(Attribute::SanitizeMemory))
+ return false;
+
return true;
}
OpenPOWER on IntegriCloud