1 ; Test basic address sanitizer instrumentation.
3 ; RUN: opt -asan -asan-module -S < %s | FileCheck %s
5 target triple = "x86_64-pc-windows-msvc"
6 ; CHECK: @llvm.global_ctors = {{.*}}@asan.module_ctor
8 define i32 @test_load(i32* %a) sanitize_address {
9 ; First instrumentation in the function must be to load the dynamic shadow
10 ; address into a local variable.
11 ; CHECK-LABEL: @test_load
13 ; CHECK-NEXT: %[[SHADOW:[^ ]*]] = load i64, i64* @__asan_shadow_memory_dynamic_address
15 ; Shadow address is loaded and added into the whole offset computation.
16 ; CHECK add i64 %{{.*}}, %[[SHADOW] ]
19 %tmp1 = load i32, i32* %a, align 4
23 define i32 @__asan_options(i32* %a) sanitize_address {
24 ; Asan functions are not instrumented. Asan function may be called by
25 ; __asan_init before the shadow initialisation, which may lead to incorrect
26 ; behavior of the instrumented code.
27 ; CHECK-LABEL: @__asan_options
29 ; CHECK-NEXT: %tmp1 = load i32, i32* %a, align 4
30 ; CHECK-NEXT: ret i32 %tmp1
33 %tmp1 = load i32, i32* %a, align 4