1; Test -asan-force-dynamic-shadow flag.
2;
3; RUN: opt -asan -asan-module -enable-new-pm=0 -S -asan-force-dynamic-shadow=1 < %s | FileCheck %s --check-prefixes=CHECK,CHECK-FDS
4; RUN: opt -passes='asan-pipeline' -S -asan-force-dynamic-shadow=1 < %s | FileCheck %s --check-prefixes=CHECK,CHECK-FDS
5; RUN: opt -asan -asan-module -enable-new-pm=0 -S -asan-force-dynamic-shadow=0 < %s | FileCheck %s --check-prefixes=CHECK,CHECK-NDS
6; RUN: opt -passes='asan-pipeline' -S -asan-force-dynamic-shadow=0 < %s | FileCheck %s --check-prefixes=CHECK,CHECK-NDS
7
8target triple = "x86_64-unknown-linux-gnu"
9
10define i32 @test_load(i32* %a) sanitize_address {
11; First instrumentation in the function must be to load the dynamic shadow
12; address into a local variable.
13; CHECK-LABEL: @test_load
14; CHECK: entry:
15; CHECK-FDS-NEXT: %[[SHADOW:[^ ]*]] = load i64, i64* @__asan_shadow_memory_dynamic_address
16; CHECK-NDS-NOT: __asan_shadow_memory_dynamic_address
17
18; Shadow address is loaded and added into the whole offset computation.
19; CHECK-FDS: add i64 %{{.*}}, %[[SHADOW]]
20
21entry:
22  %tmp1 = load i32, i32* %a, align 4
23  ret i32 %tmp1
24}
25