1 ; RUN: opt < %s -passes=asan -S | FileCheck %s
2 ; AddressSanitizer must insert __asan_handle_no_return
3 ; before noreturn calls that aren't inserted by sanitizers.
5 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
6 target triple = "x86_64-unknown-linux-gnu"
8 declare void @NormalFunc()
9 declare void @NoReturnFunc() noreturn
11 ; Instrument noreturn callsites (regardless of function)
12 define i32 @Call1() sanitize_address {
13 call void @NormalFunc() noreturn
17 ; CHECK-NEXT: call void @__asan_handle_no_return
18 ; CHECK-NEXT: call void @NormalFunc
20 ; Instrument calls to noreturn functions (regardless of callsite)
21 define i32 @Call2() sanitize_address {
22 call void @NoReturnFunc()
26 ; CHECK-NEXT: call void @__asan_handle_no_return
27 ; CHECK-NEXT: call void @NoReturnFunc
29 ; Do *not* instrument callsites marked !nosanitize
30 define i32 @Call3() sanitize_address {
31 call void @NoReturnFunc() noreturn, !nosanitize !{}
35 ; CHECK-NOT: call void @__asan_handle_no_return
36 ; CHECK: call void @NoReturnFunc
38 ; Do *not* instrument functions without ASan
40 call void @NoReturnFunc() noreturn
44 ; CHECK-NOT: call void @__asan_handle_no_return
45 ; CHECK: call void @NoReturnFunc
47 declare i32 @__gxx_personality_v0(...)
49 define i64 @Invoke1() nounwind uwtable ssp sanitize_address personality ptr @__gxx_personality_v0 {
51 invoke void @NoReturnFunc()
52 to label %invoke.cont unwind label %lpad
58 %0 = landingpad { ptr, i32 }
59 filter [0 x ptr] zeroinitializer
62 ; CHECK-LABEL: @Invoke1
63 ; CHECK: call void @__asan_handle_no_return
64 ; CHECK-NEXT: invoke void @NoReturnFunc