summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2016-07-01 22:49:59 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2016-07-01 22:49:59 +0000
commitb736335dc3e3aca2c2dd0cfb676d00e119e3cc91 (patch)
tree36dec7d3b49caa24a9eea094ceb60c05363b183d /llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
parent327bb5ad82328bb92907bb2acf87e2282593e1e4 (diff)
downloadbcm5719-llvm-b736335dc3e3aca2c2dd0cfb676d00e119e3cc91.tar.gz
bcm5719-llvm-b736335dc3e3aca2c2dd0cfb676d00e119e3cc91.zip
[msan] Fix __msan_maybe_ for non-standard type sizes.
Fix incorrect calculation of the type size for __msan_maybe_warning_N call that resulted in an invalid (narrowing) zext instruction and "Assertion `castIsValid(op, S, Ty) && "Invalid cast!"' failed." Only happens in very large functions (with more than 3500 MSan checks) operating on integer types that are not power-of-two. llvm-svn: 274395
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp')
-rw-r--r--llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
index 30c8f023cb2..970f9ab86e8 100644
--- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -610,7 +610,7 @@ CreateVarArgHelper(Function &Func, MemorySanitizer &Msan,
unsigned TypeSizeToSizeIndex(unsigned TypeSize) {
if (TypeSize <= 8) return 0;
- return Log2_32_Ceil(TypeSize / 8);
+ return Log2_32_Ceil((TypeSize + 7) / 8);
}
/// This class does all the work for a given function. Store and Load
OpenPOWER on IntegriCloud