aboutsummaryrefslogtreecommitdiffstats
path: root/test/Instrumentation
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2013-07-03 14:39:14 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2013-07-03 14:39:14 +0000
commitd55ef5ce5f92fc02063e65ef328b89a7d66a3636 (patch)
tree8039d43eb2b86d94ac7d97c5927a0423fb5c40f7 /test/Instrumentation
parentbf8eb3d55cc0fe37d0ef140c2492214083a48dcb (diff)
downloadexternal_llvm-d55ef5ce5f92fc02063e65ef328b89a7d66a3636.zip
external_llvm-d55ef5ce5f92fc02063e65ef328b89a7d66a3636.tar.gz
external_llvm-d55ef5ce5f92fc02063e65ef328b89a7d66a3636.tar.bz2
[msan] Unpoison stack allocations and undef values in blacklisted functions.
This changes behavior of -msan-poison-stack=0 flag from not poisoning stack allocations to actively unpoisoning them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185538 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Instrumentation')
-rw-r--r--test/Instrumentation/MemorySanitizer/msan_basic.ll35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/Instrumentation/MemorySanitizer/msan_basic.ll b/test/Instrumentation/MemorySanitizer/msan_basic.ll
index 3a8092b..4fa0319 100644
--- a/test/Instrumentation/MemorySanitizer/msan_basic.ll
+++ b/test/Instrumentation/MemorySanitizer/msan_basic.ll
@@ -638,6 +638,41 @@ declare void @bar()
; CHECK: ret i32
+; Test that stack allocations are unpoisoned in functions missing
+; sanitize_memory attribute
+
+define i32 @NoSanitizeMemoryAlloca() {
+entry:
+ %p = alloca i32, align 4
+ %x = call i32 @NoSanitizeMemoryAllocaHelper(i32* %p)
+ ret i32 %x
+}
+
+declare i32 @NoSanitizeMemoryAllocaHelper(i32* %p)
+
+; CHECK: @NoSanitizeMemoryAlloca
+; CHECK: call void @llvm.memset.p0i8.i64(i8* {{.*}}, i8 0, i64 4, i32 4, i1 false)
+; CHECK: call i32 @NoSanitizeMemoryAllocaHelper(i32*
+; CHECK: ret i32
+
+
+; Test that undef is unpoisoned in functions missing
+; sanitize_memory attribute
+
+define i32 @NoSanitizeMemoryUndef() {
+entry:
+ %x = call i32 @NoSanitizeMemoryUndefHelper(i32 undef)
+ ret i32 %x
+}
+
+declare i32 @NoSanitizeMemoryUndefHelper(i32 %x)
+
+; CHECK: @NoSanitizeMemoryAlloca
+; CHECK: store i32 0, i32* {{.*}} @__msan_param_tls
+; CHECK: call i32 @NoSanitizeMemoryUndefHelper(i32 undef)
+; CHECK: ret i32
+
+
; Test argument shadow alignment
define <2 x i64> @ArgumentShadowAlignment(i64 %a, <2 x i64> %b) sanitize_memory {