[llvm] r369979 - msan, codegen, instcombine: Keep more lifetime markers used for msan
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 26 15:15:50 PDT 2019
Author: vitalybuka
Date: Mon Aug 26 15:15:50 2019
New Revision: 369979
URL: http://llvm.org/viewvc/llvm-project?rev=369979&view=rev
Log:
msan, codegen, instcombine: Keep more lifetime markers used for msan
Reviewers: eugenis
Subscribers: hiraditya, cfe-commits, #sanitizers, llvm-commits
Tags: #clang, #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D66695
Modified:
llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/trunk/test/Transforms/InstCombine/lifetime-sanitizer.ll
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp?rev=369979&r1=369978&r2=369979&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp Mon Aug 26 15:15:50 2019
@@ -3885,6 +3885,7 @@ Instruction *InstCombiner::visitCallInst
// Asan needs to poison memory to detect invalid access which is possible
// even for empty lifetime range.
if (II->getFunction()->hasFnAttribute(Attribute::SanitizeAddress) ||
+ II->getFunction()->hasFnAttribute(Attribute::SanitizeMemory) ||
II->getFunction()->hasFnAttribute(Attribute::SanitizeHWAddress))
break;
Modified: llvm/trunk/test/Transforms/InstCombine/lifetime-sanitizer.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/lifetime-sanitizer.ll?rev=369979&r1=369978&r2=369979&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/lifetime-sanitizer.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/lifetime-sanitizer.ll Mon Aug 26 15:15:50 2019
@@ -34,6 +34,21 @@ entry:
ret void
}
+define void @msan() sanitize_memory {
+entry:
+ ; CHECK-LABEL: @msan(
+ %text = alloca i8, align 1
+
+ call void @llvm.lifetime.start.p0i8(i64 1, i8* %text)
+ call void @llvm.lifetime.end.p0i8(i64 1, i8* %text)
+ ; CHECK: call void @llvm.lifetime.start
+ ; CHECK-NEXT: call void @llvm.lifetime.end
+
+ call void @foo(i8* %text) ; Keep alloca alive
+
+ ret void
+}
+
define void @no_asan() {
entry:
; CHECK-LABEL: @no_asan(
More information about the llvm-commits
mailing list