aboutsummaryrefslogtreecommitdiffstats
path: root/test/Instrumentation
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2013-06-26 09:18:17 +0000
committerKostya Serebryany <kcc@google.com>2013-06-26 09:18:17 +0000
commit20985711c76b8799d689a9c0e416b68896333c23 (patch)
treefa5883c0df8c04926aae0cc468fda673f58714b9 /test/Instrumentation
parent0259c0cde56209caf711527b4214d5ab0d3a9647 (diff)
downloadexternal_llvm-20985711c76b8799d689a9c0e416b68896333c23.zip
external_llvm-20985711c76b8799d689a9c0e416b68896333c23.tar.gz
external_llvm-20985711c76b8799d689a9c0e416b68896333c23.tar.bz2
[asan] add option -asan-keep-uninstrumented-functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184927 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Instrumentation')
-rw-r--r--test/Instrumentation/AddressSanitizer/keep-instrumented_functions.ll23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/Instrumentation/AddressSanitizer/keep-instrumented_functions.ll b/test/Instrumentation/AddressSanitizer/keep-instrumented_functions.ll
new file mode 100644
index 0000000..ff3bbb0
--- /dev/null
+++ b/test/Instrumentation/AddressSanitizer/keep-instrumented_functions.ll
@@ -0,0 +1,23 @@
+; Test the -asan-keep-uninstrumented-functions flag: FOO should get cloned
+; RUN: opt < %s -asan -asan-keep-uninstrumented-functions -S | FileCheck %s
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+@a = global i32 0, align 4
+
+define i32 @main() sanitize_address {
+entry:
+ tail call void @FOO(i32* @a)
+ ret i32 0
+}
+
+define void @FOO(i32* nocapture %x) sanitize_address {
+entry:
+ store i32 1, i32* %x, align 4
+ ret void
+}
+
+; main should not be cloned since it is not being instrumented by asan.
+; CHECK-NOT: NOASAN_main
+; CHECK: define void @FOO{{.*}} section "ASAN"
+; CHECK: define void @NOASAN_FOO{{.*}} section "NOASAN"