1 ; RUN: opt < %s -mtriple aarch64-linux-android29 -hwasan -S | FileCheck %s --check-prefix=NOPERS
2 ; RUN: opt < %s -mtriple aarch64-linux-android30 -hwasan -S | FileCheck %s --check-prefix=PERS
4 ; NOPERS: define void @nostack() #{{[0-9]+}} {
5 ; PERS: define void @nostack() #{{[0-9]+}} {
6 define void @nostack() sanitize_hwaddress {
10 ; NOPERS: define void @stack1() #{{[0-9]+}} {
11 ; PERS: personality {{.*}} @__hwasan_personality_thunk
12 define void @stack1() sanitize_hwaddress {
14 call void @sink(i8* %p)
19 ; NOPERS: personality void ()* @global
20 ; PERS: personality {{.*}} @__hwasan_personality_thunk.global
21 define void @stack2() sanitize_hwaddress personality void ()* @global {
23 call void @sink(i8* %p)
27 define internal void @local() {
31 @local_alias = internal alias void (), void ()* @local
33 ; NOPERS: personality void ()* @local
34 ; PERS: personality {{.*}} @__hwasan_personality_thunk.local
35 define void @stack3() sanitize_hwaddress personality void ()* @local {
37 call void @sink(i8* %p)
41 ; NOPERS: personality void ()* @local_alias
42 ; PERS: personality {{.*}} @__hwasan_personality_thunk.local_alias
43 define void @stack4() sanitize_hwaddress personality void ()* @local_alias {
45 call void @sink(i8* %p)
49 ; NOPERS: personality void ()* inttoptr (i64 1 to void ()*)
50 ; PERS: personality i32 (i32, i32, i64, i8*, i8*)* @__hwasan_personality_thunk.
51 define void @stack5() sanitize_hwaddress personality void ()* inttoptr (i64 1 to void ()*) {
53 call void @sink(i8* %p)
57 ; NOPERS: personality void ()* inttoptr (i64 2 to void ()*)
58 ; PERS: personality i32 (i32, i32, i64, i8*, i8*)* @__hwasan_personality_thunk..1
59 define void @stack6() sanitize_hwaddress personality void ()* inttoptr (i64 2 to void ()*) {
61 call void @sink(i8* %p)
65 declare void @global()
66 declare void @sink(i8*)
68 ; PERS: define linkonce_odr hidden i32 @__hwasan_personality_thunk(i32 %0, i32 %1, i64 %2, i8* %3, i8* %4) comdat
69 ; PERS: %5 = tail call i32 @__hwasan_personality_wrapper(i32 %0, i32 %1, i64 %2, i8* %3, i8* %4, i8* null, i8* bitcast (void ()* @_Unwind_GetGR to i8*), i8* bitcast (void ()* @_Unwind_GetCFA to i8*))
72 ; PERS: define linkonce_odr hidden i32 @__hwasan_personality_thunk.global(i32 %0, i32 %1, i64 %2, i8* %3, i8* %4) comdat
73 ; PERS: %5 = tail call i32 @__hwasan_personality_wrapper(i32 %0, i32 %1, i64 %2, i8* %3, i8* %4, i8* bitcast (void ()* @global to i8*), i8* bitcast (void ()* @_Unwind_GetGR to i8*), i8* bitcast (void ()* @_Unwind_GetCFA to i8*))
76 ; PERS: define internal i32 @__hwasan_personality_thunk.local(i32 %0, i32 %1, i64 %2, i8* %3, i8* %4)
77 ; PERS: %5 = tail call i32 @__hwasan_personality_wrapper(i32 %0, i32 %1, i64 %2, i8* %3, i8* %4, i8* bitcast (void ()* @local to i8*), i8* bitcast (void ()* @_Unwind_GetGR to i8*), i8* bitcast (void ()* @_Unwind_GetCFA to i8*))
80 ; PERS: define internal i32 @__hwasan_personality_thunk.local_alias(i32 %0, i32 %1, i64 %2, i8* %3, i8* %4)
81 ; PERS: %5 = tail call i32 @__hwasan_personality_wrapper(i32 %0, i32 %1, i64 %2, i8* %3, i8* %4, i8* bitcast (void ()* @local_alias to i8*), i8* bitcast (void ()* @_Unwind_GetGR to i8*), i8* bitcast (void ()* @_Unwind_GetCFA to i8*))
84 ; PERS: define internal i32 @__hwasan_personality_thunk.(i32 %0, i32 %1, i64 %2, i8* %3, i8* %4) {
85 ; PERS: %5 = tail call i32 @__hwasan_personality_wrapper(i32 %0, i32 %1, i64 %2, i8* %3, i8* %4, i8* inttoptr (i64 1 to i8*), i8* bitcast (void ()* @_Unwind_GetGR to i8*), i8* bitcast (void ()* @_Unwind_GetCFA to i8*))
88 ; PERS: define internal i32 @__hwasan_personality_thunk..1(i32 %0, i32 %1, i64 %2, i8* %3, i8* %4) {
89 ; PERS: %5 = tail call i32 @__hwasan_personality_wrapper(i32 %0, i32 %1, i64 %2, i8* %3, i8* %4, i8* inttoptr (i64 2 to i8*), i8* bitcast (void ()* @_Unwind_GetGR to i8*), i8* bitcast (void ()* @_Unwind_GetCFA to i8*))