1 ; This test checks that we are not instrumenting sanitizer code.
2 ; RUN: opt < %s -passes=asan -S | FileCheck %s
4 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
5 target triple = "x86_64-unknown-linux-gnu"
7 ; Function with sanitize_address is instrumented.
8 ; Function Attrs: nounwind uwtable
9 define void @instr_sa(ptr %a) sanitize_address {
11 %tmp1 = load i32, ptr %a, align 4
12 %tmp2 = add i32 %tmp1, 1
13 store i32 %tmp2, ptr %a, align 4
17 ; CHECK-LABEL: @instr_sa
18 ; CHECK: call void @__asan_report_load
21 ; Function with disable_sanitizer_instrumentation is not instrumented.
22 ; Function Attrs: nounwind uwtable
23 define void @noinstr_dsi(ptr %a) disable_sanitizer_instrumentation {
25 %tmp1 = load i32, ptr %a, align 4
26 %tmp2 = add i32 %tmp1, 1
27 store i32 %tmp2, ptr %a, align 4
31 ; CHECK-LABEL: @noinstr_dsi
32 ; CHECK-NOT: call void @__asan_report_load
35 ; disable_sanitizer_instrumentation takes precedence over sanitize_address.
36 ; Function Attrs: nounwind uwtable
37 define void @noinstr_dsi_sa(ptr %a) disable_sanitizer_instrumentation sanitize_address {
39 %tmp1 = load i32, ptr %a, align 4
40 %tmp2 = add i32 %tmp1, 1
41 store i32 %tmp2, ptr %a, align 4
45 ; CHECK-LABEL: @noinstr_dsi_sa
46 ; CHECK-NOT: call void @__asan_report_load