1 ; RUN: opt < %s -passes=asan -asan-use-after-return=never -asan-stack-dynamic-alloca -S | FileCheck %s
2 ; RUN: opt < %s -passes=asan -asan-use-after-return=runtime -asan-stack-dynamic-alloca -S | FileCheck %s
3 ; RUN: opt < %s -passes=asan -asan-use-after-return=always -asan-stack-dynamic-alloca -S | FileCheck %s
4 ; RUN: opt < %s -passes=asan -asan-use-after-return=never -asan-stack-dynamic-alloca=0 -S | FileCheck %s
5 ; RUN: opt < %s -passes=asan -asan-use-after-return=runtime -asan-stack-dynamic-alloca=0 -S | FileCheck %s
6 ; RUN: opt < %s -passes=asan -asan-use-after-return=always -asan-stack-dynamic-alloca=0 -S | FileCheck %s
8 target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
9 target triple = "i686-pc-windows-msvc18.0.0"
11 declare i32 @llvm.eh.typeid.for(ptr) #2
12 declare ptr @llvm.frameaddress(i32)
13 declare ptr @llvm.eh.recoverfp(ptr, ptr)
14 declare ptr @llvm.localrecover(ptr, ptr, i32)
15 declare void @llvm.localescape(...) #1
17 declare i32 @__gcc_personality_v0(...)
18 declare void @may_throw(ptr %r)
20 define i32 @main() sanitize_address personality ptr @__gcc_personality_v0 {
22 %r = alloca i32, align 4
23 %__exception_code = alloca i32, align 4
24 call void (...) @llvm.localescape(ptr nonnull %__exception_code)
25 store i32 0, ptr %r, align 4
26 invoke void @may_throw(ptr nonnull %r) #4
27 to label %__try.cont unwind label %lpad
29 lpad: ; preds = %entry
30 %0 = landingpad { ptr, i32 }
31 catch ptr @"\01?filt$0@0@main@@"
32 %1 = extractvalue { ptr, i32 } %0, 1
33 %2 = call i32 @llvm.eh.typeid.for(ptr @"\01?filt$0@0@main@@") #1
34 %matches = icmp eq i32 %1, %2
35 br i1 %matches, label %__except, label %eh.resume
37 __except: ; preds = %lpad
38 store i32 1, ptr %r, align 4
41 __try.cont: ; preds = %entry, %__except
42 %3 = load i32, ptr %r, align 4
45 eh.resume: ; preds = %lpad
46 resume { ptr, i32 } %0
49 ; Check that the alloca remains static and the localescape call remains in the
52 ; CHECK-LABEL: define i32 @main()
53 ; CHECK-NOT: br {{.*}}label
54 ; CHECK: %__exception_code = alloca i32, align 4
55 ; CHECK-NOT: br {{.*}}label
56 ; CHECK: call void (...) @llvm.localescape(ptr nonnull %__exception_code)
58 ; Function Attrs: nounwind
59 define internal i32 @"\01?filt$0@0@main@@"() #1 {
61 %0 = tail call ptr @llvm.frameaddress(i32 1)
62 %1 = tail call ptr @llvm.eh.recoverfp(ptr @main, ptr %0)
63 %2 = tail call ptr @llvm.localrecover(ptr @main, ptr %1, i32 0)
64 %3 = getelementptr inbounds i8, ptr %0, i32 -20
65 %4 = load ptr, ptr %3, align 4
66 %5 = getelementptr inbounds { ptr, ptr }, ptr %4, i32 0, i32 0
67 %6 = load ptr, ptr %5, align 4
68 %7 = load i32, ptr %6, align 4
69 store i32 %7, ptr %2, align 4
73 ; CHECK-LABEL: define internal i32 @"\01?filt$0@0@main@@"()
74 ; CHECK: tail call ptr @llvm.localrecover(ptr @main, ptr {{.*}}, i32 0)
76 define void @ScaleFilterCols_SSSE3(ptr %dst_ptr, ptr %src_ptr, i32 %dst_width, i32 %x, i32 %dx) sanitize_address {
78 %dst_width.addr = alloca i32, align 4
79 store i32 %dst_width, ptr %dst_width.addr, align 4
80 %0 = call { ptr, ptr, i32, i32, i32 } asm sideeffect "", "=r,=r,={ax},=r,=r,=*rm,rm,rm,0,1,2,3,4,5,~{memory},~{cc},~{xmm0},~{xmm1},~{xmm2},~{xmm3},~{xmm4},~{xmm5},~{xmm6},~{dirflag},~{fpsr},~{flags}"(ptr elementtype(i32) nonnull %dst_width.addr, i32 %x, i32 %dx, ptr %dst_ptr, ptr %src_ptr, i32 0, i32 0, i32 0, i32 %dst_width)
84 define void @ScaleColsUp2_SSE2() sanitize_address {