[msan] Fix handling of multiplication by a constant with a number of trailing zeroes.
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Tue, 17 Jun 2014 09:23:12 +0000 (09:23 +0000)
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Tue, 17 Jun 2014 09:23:12 +0000 (09:23 +0000)
commit792a17352302c8305368ac5e836e5b132c604898
tree51adaf4d4d107042ae9c3d0945083ff97da89911
parentfeacf821802eb294cc228d26bd3add4d918c7957
[msan] Fix handling of multiplication by a constant with a number of trailing zeroes.

Multiplication by an integer with a number of trailing zero bits leaves
the same number of lower bits of the result initialized to zero.
This change makes MSan take this into account in the case of multiplication by
a compile-time constant.

We don't handle the general, non-constant, case because
(a) it's not going to be cheap (computation-wise);
(b) multiplication by a partially uninitialized value in user code is
    a bad idea anyway.

Constant case must be handled because it appears from LLVM optimization of a
completely valid user code, as the test case in compiler-rt demonstrates.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211092 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Instrumentation/MemorySanitizer.cpp
test/Instrumentation/MemorySanitizer/mul_by_constant.ll [new file with mode: 0644]