[NewPM] Port Msan
authorPhilip Pfaffe <philip.pfaffe@gmail.com>
Thu, 3 Jan 2019 13:42:44 +0000 (13:42 +0000)
committerPhilip Pfaffe <philip.pfaffe@gmail.com>
Thu, 3 Jan 2019 13:42:44 +0000 (13:42 +0000)
commitb39a97c8f6c02f5ce9d048849dfae4c3ee26d5ee
tree2c869409a8f53707cc504dbbbf57ed11d9a668cb
parentb0826bdffe48b91d9d1dad7437e2266635c5b7dd
[NewPM] Port Msan

Summary:
Keeping msan a function pass requires replacing the module level initialization:
That means, don't define a ctor function which calls __msan_init, instead just
declare the init function at the first access, and add that to the global ctors
list.

Changes:
- Pull the actual sanitizer and the wrapper pass apart.
- Add a newpm msan pass. The function pass inserts calls to runtime
  library functions, for which it inserts declarations as necessary.
- Update tests.

Caveats:
- There is one test that I dropped, because it specifically tested the
  definition of the ctor.

Reviewers: chandlerc, fedor.sergeev, leonardchan, vitalybuka

Subscribers: sdardis, nemanjai, javed.absar, hiraditya, kbarton, bollu, atanasyan, jsji

Differential Revision: https://reviews.llvm.org/D55647

llvm-svn: 350305
55 files changed:
clang/lib/CodeGen/BackendUtil.cpp
llvm/bindings/go/llvm/InstrumentationBindings.cpp
llvm/bindings/go/llvm/InstrumentationBindings.h
llvm/bindings/go/llvm/transforms_instrumentation.go
llvm/include/llvm/InitializePasses.h
llvm/include/llvm/Transforms/Instrumentation.h
llvm/include/llvm/Transforms/Instrumentation/MemorySanitizer.h [new file with mode: 0644]
llvm/include/llvm/Transforms/Utils/ModuleUtils.h
llvm/lib/Passes/PassBuilder.cpp
llvm/lib/Passes/PassRegistry.def
llvm/lib/Transforms/Instrumentation/Instrumentation.cpp
llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
llvm/lib/Transforms/Utils/ModuleUtils.cpp
llvm/test/Instrumentation/MemorySanitizer/AArch64/vararg.ll
llvm/test/Instrumentation/MemorySanitizer/Mips/vararg-mips64.ll
llvm/test/Instrumentation/MemorySanitizer/Mips/vararg-mips64el.ll
llvm/test/Instrumentation/MemorySanitizer/PowerPC/vararg-ppc64.ll
llvm/test/Instrumentation/MemorySanitizer/PowerPC/vararg-ppc64le.ll
llvm/test/Instrumentation/MemorySanitizer/X86/vararg-too-large.ll
llvm/test/Instrumentation/MemorySanitizer/X86/vararg.ll
llvm/test/Instrumentation/MemorySanitizer/X86/vararg_call.ll
llvm/test/Instrumentation/MemorySanitizer/alloca.ll
llvm/test/Instrumentation/MemorySanitizer/array_types.ll
llvm/test/Instrumentation/MemorySanitizer/atomics.ll
llvm/test/Instrumentation/MemorySanitizer/byval-alignment.ll
llvm/test/Instrumentation/MemorySanitizer/check-constant-shadow.ll
llvm/test/Instrumentation/MemorySanitizer/check_access_address.ll
llvm/test/Instrumentation/MemorySanitizer/csr.ll
llvm/test/Instrumentation/MemorySanitizer/global_ctors_2to3.ll [deleted file]
llvm/test/Instrumentation/MemorySanitizer/instrumentation-with-call-threshold.ll
llvm/test/Instrumentation/MemorySanitizer/manual-shadow.ll
llvm/test/Instrumentation/MemorySanitizer/masked-store-load.ll
llvm/test/Instrumentation/MemorySanitizer/missing_origin.ll
llvm/test/Instrumentation/MemorySanitizer/msan_asm_conservative.ll
llvm/test/Instrumentation/MemorySanitizer/msan_basic.ll
llvm/test/Instrumentation/MemorySanitizer/msan_kernel_basic.ll
llvm/test/Instrumentation/MemorySanitizer/msan_x86_bts_asm.ll
llvm/test/Instrumentation/MemorySanitizer/msan_x86intrinsics.ll
llvm/test/Instrumentation/MemorySanitizer/mul_by_constant.ll
llvm/test/Instrumentation/MemorySanitizer/nosanitize.ll
llvm/test/Instrumentation/MemorySanitizer/origin-alignment.ll
llvm/test/Instrumentation/MemorySanitizer/origin-array.ll
llvm/test/Instrumentation/MemorySanitizer/pr32842.ll
llvm/test/Instrumentation/MemorySanitizer/return_from_main.ll
llvm/test/Instrumentation/MemorySanitizer/store-long-origin.ll
llvm/test/Instrumentation/MemorySanitizer/store-origin.ll
llvm/test/Instrumentation/MemorySanitizer/str-nobuiltin.ll
llvm/test/Instrumentation/MemorySanitizer/unreachable.ll
llvm/test/Instrumentation/MemorySanitizer/unsized_type.ll
llvm/test/Instrumentation/MemorySanitizer/vector_arith.ll
llvm/test/Instrumentation/MemorySanitizer/vector_cmp.ll
llvm/test/Instrumentation/MemorySanitizer/vector_cvt.ll
llvm/test/Instrumentation/MemorySanitizer/vector_pack.ll
llvm/test/Instrumentation/MemorySanitizer/vector_shift.ll
llvm/test/Instrumentation/MemorySanitizer/with-call-type-size.ll