[all-commits] [llvm/llvm-project] c47ec9: [MemorySanitizer] Support memcpy.inline and memset...

Marco Elver via All-commits all-commits at lists.llvm.org
Thu Aug 11 01:45:29 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c47ec95531619fcc4faaf2c74de49779b71a5b5b
      https://github.com/llvm/llvm-project/commit/c47ec95531619fcc4faaf2c74de49779b71a5b5b
  Author: Marco Elver <elver at google.com>
  Date:   2022-08-11 (Thu, 11 Aug 2022)

  Changed paths:
    M llvm/include/llvm/IR/InstVisitor.h
    M llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
    M llvm/test/Instrumentation/AddressSanitizer/mem-intrinsics.ll
    M llvm/test/Instrumentation/MemorySanitizer/msan_basic.ll
    M llvm/test/Instrumentation/ThreadSanitizer/tsan_basic.ll

  Log Message:
  -----------
  [MemorySanitizer] Support memcpy.inline and memset.inline

Other sanitizers (ASan, TSan, see added tests) already handle
memcpy.inline and memset.inline by not relying on InstVisitor to turn
the intrinsics into calls. Only MSan instrumentation currently does not
support them due to missing InstVisitor callbacks.

Fix it by actually making InstVisitor handle Mem*InlineInst.

While the mem*.inline intrinsics promise no calls to external functions
as an optimization, for the sanitizers we need to break this guarantee
since access into the runtime is required either way, and performance
can no longer be guaranteed. All other cases, where generating a call is
incorrect, should instead use no_sanitize.

Fixes: https://github.com/llvm/llvm-project/issues/57048

Reviewed By: vitalybuka, dvyukov

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




More information about the All-commits mailing list