[sanitizer] Improve FreeBSD ASLR detection
[llvm-project.git] / llvm / test / Instrumentation / DataFlowSanitizer / call.ll
blobadd9d9df3a24d09c70ff2e28fdf5cceb5fcee6f0
1 ; RUN: opt < %s -dfsan -S | FileCheck %s
2 ; RUN: opt < %s -passes=dfsan -S | FileCheck %s
3 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-S128"
4 target triple = "x86_64-unknown-linux-gnu"
6 ; CHECK-LABEL: @__dfsan_arg_tls
7 ; CHECK: = external thread_local(initialexec) global [100 x i64]
9 ; CHECK-LABEL: @__dfsan_retval_tls
10 ; CHECK: = external thread_local(initialexec) global [100 x i64]
12 declare i32 @f(i32)
13 declare float @llvm.sqrt.f32(float)
15 ; CHECK-LABEL: @call.dfsan
16 define i32 @call() {
17   ; CHECK: store{{.*}}__dfsan_arg_tls
18   ; CHECK: call{{.*}}@f.dfsan
19   ; CHECK: load{{.*}}__dfsan_retval_tls
20   %r = call i32 @f(i32 0)
22   ; CHECK-NOT: store{{.*}}__dfsan_arg_tls
23   %i = call float @llvm.sqrt.f32(float -1.0)
25   ; CHECK: store{{.*}}__dfsan_retval_tls
26   ; CHECK: ret i32
27   ret i32 %r
30 declare i32 @__gxx_personality_v0(...)
32 declare i8* @__cxa_begin_catch(i8*)
34 declare void @__cxa_end_catch()
36 declare void @g(...)
38 ; CHECK-LABEL: @h.dfsan
39 ; CHECK: personality {{.*}} @__gxx_personality_v0.dfsan {{.*}} {
40 define i32 @h() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
41 entry:
42 ; CHECK: invoke void (...) @g.dfsan(i32 42)
43   invoke void (...) @g(i32 42)
44           to label %try.cont unwind label %lpad
46 lpad:
47   %0 = landingpad { i8*, i32 }
48           catch i8* null
49   %1 = extractvalue { i8*, i32 } %0, 0
51   ; CHECK: store {{.*}} @__dfsan_arg_tls  
52   ; CHECK: call {{.*}} @__cxa_begin_catch.dfsan
53   ; CHECK: load {{.*}} @__dfsan_retval_tls
54   %2 = tail call i8* @__cxa_begin_catch(i8* %1)
56   ; CHECK: call {{.*}} @__cxa_end_catch.dfsan
57   tail call void @__cxa_end_catch()
58   br label %try.cont
60 try.cont:
61   ret i32 0