[asan] support for FreeBSD, LLVM part. patch by Viktor Kutuzov
[oota-llvm.git] / test / Instrumentation / AddressSanitizer / keep-instrumented_functions.ll
1 ; Test the -asan-keep-uninstrumented-functions flag: FOO should get cloned
2 ; RUN: opt < %s -asan -asan-keep-uninstrumented-functions -S | FileCheck %s
3 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"
4 target triple = "x86_64-unknown-linux-gnu"
5
6 @a = global i32 0, align 4
7
8 define i32 @main() sanitize_address {
9 entry:
10   tail call void @FOO(i32* @a)
11   ret i32 0
12 }
13
14 define void @FOO(i32* nocapture %x) sanitize_address {
15 entry:
16   store i32 1, i32* %x, align 4
17   ret void
18 }
19
20 ; main should not be cloned since it is not being instrumented by asan.
21 ; CHECK-NOT: NOASAN_main
22 ; CHECK: define void @FOO{{.*}} section "ASAN"
23 ; CHECK: define void @NOASAN_FOO{{.*}} section "NOASAN"