commit | e62fc3d0b6ce923dcbc29eeb6ebc5808e6724f90 | [log] [tgz] |
---|---|---|
author | Matt Morehouse <mascasa@google.com> | Wed Sep 19 19:37:24 2018 +0000 |
committer | Matt Morehouse <mascasa@google.com> | Wed Sep 19 19:37:24 2018 +0000 |
tree | e5fadc259b3b063b9ddb6a12d82ce1c5b67a9c81 | |
parent | a4526d77c9921c86a29889fc09de17f7d5ccb210 [diff] [blame] |
[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
diff --git a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp index 8fa2279..3789181 100644 --- a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
@@ -171,7 +171,10 @@ if (!isDereferenceableAndAlignedPointer(Str, 1, APInt(64, Len), DL)) return false; - + + if (CI->getFunction()->hasFnAttribute(Attribute::SanitizeMemory)) + return false; + return true; }