]> granicus.if.org Git - llvm/commit
Handle llvm.launder.invariant.group in msan.
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Wed, 2 Oct 2019 19:53:19 +0000 (19:53 +0000)
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Wed, 2 Oct 2019 19:53:19 +0000 (19:53 +0000)
commitf35391129a1684ddbb8916a7a75f7ff546fbd6bc
tree5ef6860ac299161449bb70f638f6e2c73b53d2ea
parent45ff6456d26c47fb8e0099dfee223783722bad46
Handle llvm.launder.invariant.group in msan.

Summary:
[MSan] handle llvm.launder.invariant.group

    Msan used to give false-positives in

    class Foo {
     public:
      virtual ~Foo() {};
    };

    // Return true iff *x is set.
    bool f1(void **x, bool flag);

    Foo* f() {
      void *p;
      bool found;
      found = f1(&p,flag);
      if (found) {
        // p is always set here.
        return static_cast<Foo*>(p); // False positive here.
      }
      return nullptr;
    }

Patch by Ilya Tokar.

Reviewers: #sanitizers, eugenis

Reviewed By: #sanitizers, eugenis

Subscribers: eugenis, Prazek, hiraditya, llvm-commits

Tags: #llvm

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

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