[llvm-commits] [PATCH] [msan] Heuristic handling on unknown intrinsics

Evgeniy Stepanov eugenis at google.com
Thu Dec 6 05:45:12 PST 2012


Hi kcc, chandlerc,

This patch adds best-effort handling of arbitrary intrinsics. 

A comment from the code:
The main purpose of this code is to do something reasonable with all
random intrinsics we might encounter, most importantly - SIMD intrinsics.
The algorithm roughly looks like this:
1. Guess what intrinsic does by analysing its ModRefBehaviour and argument
   types.
2. Collect shadow of all scalar and vector arguments and bitwise OR it
   together.
3. If we think this intrinsics reads memory, load shadow for the base type
   of the pointer argument and bitwise OR it with the rest.
4. If we think this intrinsics writes memory, store the accumulated shadow
   by the pointer argument.
5. If the intrinsic has non-void return value, assign the accumulated
   shadow to it.
Note that this is a best-effort approach. We special-case intrinsics where
it fails. See llvm.bswap handling as an example of that.

This stuff was tested with sse2/3 code in Skia library.


http://llvm-reviews.chandlerc.com/D184

Files:
  llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
  llvm/test/Instrumentation/MemorySanitizer/msan_basic.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D184.1.patch
Type: text/x-patch
Size: 10191 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121206/1b1cbc05/attachment.bin>


More information about the llvm-commits mailing list