[msan] Do not store origin for clean values.
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Thu, 6 Dec 2012 11:41:03 +0000 (11:41 +0000)
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Thu, 6 Dec 2012 11:41:03 +0000 (11:41 +0000)
commit4031b194acd50f35b75658f66ee3bb1b4afcfd25
treebbcccc2a3fe47d96d3c8d974da061ca8c2f8acc2
parent6afe478e005bf9f112b32b7ec25879475adc1915
[msan] Do not store origin for clean values.

Instead of unconditionally storing origin with every application store,
only do this when the shadow of the stored value is != 0.

This change also delays instrumentation of stores until after the walk over
function's instructions, because adding new basic blocks confuses InstVisitor.

We only keep 1 origin value per 4 bytes of application memory. This change
fixes the bug when a store of a single clean byte wiped the origin for the
whole 4-byte area.

Since stores of uninitialized values are relatively uncommon, this change
improves performance of track-origins mode by 5% median and by up to 47% on
specs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169490 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Instrumentation/MemorySanitizer.cpp
test/Instrumentation/MemorySanitizer/msan_basic.ll