• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -dfsan -S | FileCheck %s
2target 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-S128"
3target triple = "x86_64-unknown-linux-gnu"
4
5; CHECK-LABEL: @__dfsan_arg_tls
6; CHECK: = external thread_local(initialexec) global [64 x i16]
7
8; CHECK-LABEL: @__dfsan_retval_tls
9; CHECK: = external thread_local(initialexec) global i16
10
11declare i32 @f(i32)
12declare float @llvm.sqrt.f32(float)
13
14; CHECK-LABEL: @"dfs$call"
15define i32 @call() {
16  ; CHECK: store{{.*}}__dfsan_arg_tls
17  ; CHECK: call{{.*}}@"dfs$f"
18  ; CHECK: load{{.*}}__dfsan_retval_tls
19  %r = call i32 @f(i32 0)
20
21  ; CHECK-NOT: store{{.*}}__dfsan_arg_tls
22  %i = call float @llvm.sqrt.f32(float -1.0)
23
24  ; CHECK: store{{.*}}__dfsan_retval_tls
25  ; CHECK: ret i32
26  ret i32 %r
27}
28
29declare i32 @__gxx_personality_v0(...)
30
31declare i8* @__cxa_begin_catch(i8*)
32
33declare void @__cxa_end_catch()
34
35declare void @g(...)
36
37; CHECK-LABEL: @"dfs$h"
38; CHECK: personality {{.*}} @"dfs$__gxx_personality_v0" {{.*}} {
39define i32 @h() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
40entry:
41; CHECK: invoke void (...) @"dfs$g"(i32 42)
42  invoke void (...) @g(i32 42)
43          to label %try.cont unwind label %lpad
44
45lpad:
46  %0 = landingpad { i8*, i32 }
47          catch i8* null
48  %1 = extractvalue { i8*, i32 } %0, 0
49
50  ; CHECK: store {{.*}} @__dfsan_arg_tls
51  ; CHECK: call {{.*}} @"dfs$__cxa_begin_catch"
52  ; CHECK: load {{.*}} @__dfsan_retval_tls
53  %2 = tail call i8* @__cxa_begin_catch(i8* %1)
54
55  ; CHECK: call {{.*}} @"dfs$__cxa_end_catch"
56  tail call void @__cxa_end_catch()
57  br label %try.cont
58
59try.cont:
60  ret i32 0
61}
62