1 ; RUN: opt < %s -asan -asan-module -asan-use-after-return -S | FileCheck --check-prefix=CHECK-UAR %s
2 ; RUN: opt < %s -asan -asan-module -asan-use-after-return=0 -S | FileCheck --check-prefix=CHECK-PLAIN %s
3 target datalayout = "e-i64:64-f80:128-s:64-n8:16:32:64-S128"
4 target triple = "x86_64-unknown-linux-gnu"
8 define void @Bar() uwtable sanitize_address {
10 ; CHECK-PLAIN-LABEL: Bar
11 ; CHECK-PLAIN-NOT: label
12 ; CHECK-PLAIN: ret void
14 ; CHECK-UAR-LABEL: Bar
15 ; CHECK-UAR: load i32, i32* @__asan_option_detect_stack_use_after_return
17 ; CHECK-UAR: call i64 @__asan_stack_malloc_4
20 ; CHECK-UAR: store i64 -1007680412564983311
21 ; CHECK-UAR: store i64 72057598113936114
22 ; CHECK-UAR: store i32 -218959118
23 ; CHECK-UAR: store i64 -868082074056920316
24 ; CHECK-UAR: store i16 -3085
25 ; CHECK-UAR: call void @Foo
26 ; CHECK-UAR: call void @Foo
27 ; CHECK-UAR: call void @Foo
28 ; If LocalStackBase != OrigStackBase
30 ; Then Block: poison the entire frame.
31 ; CHECK-UAR: call void @__asan_set_shadow_f5(i64 %{{[0-9]+}}, i64 128)
32 ; CHECK-UAR-NOT: store i64
34 ; Else Block: no UAR frame. Only unpoison the redzones.
35 ; CHECK-UAR: store i64 0
36 ; CHECK-UAR: store i64 0
37 ; CHECK-UAR: store i32 0
38 ; CHECK-UAR: store i64 0
39 ; CHECK-UAR: store i16 0
40 ; CHECK-UAR-NOT: store
42 ; Done, no more stores.
43 ; CHECK-UAR-NOT: store
46 %x = alloca [20 x i8], align 16
47 %y = alloca [25 x i8], align 1
48 %z = alloca [500 x i8], align 1
49 %xx = getelementptr inbounds [20 x i8], [20 x i8]* %x, i64 0, i64 0
50 call void @Foo(i8* %xx)
51 %yy = getelementptr inbounds [25 x i8], [25 x i8]* %y, i64 0, i64 0
52 call void @Foo(i8* %yy)
53 %zz = getelementptr inbounds [500 x i8], [500 x i8]* %z, i64 0, i64 0
54 call void @Foo(i8* %zz)