1 ; RUN: opt < %s -dfsan -dfsan-args-abi -dfsan-abilist=%S/Inputs/abilist.txt -S | FileCheck %s
2 ; RUN: opt < %s -dfsan -dfsan-abilist=%S/Inputs/abilist.txt -S | FileCheck %s
4 target triple = "x86_64-unknown-linux-gnu"
6 ; Declare custom functions. Inputs/abilist.txt causes any function with a
7 ; name matching /custom.*/ to be a custom function.
8 declare i32 @custom_fun_one_callback(i8 (i32, double)* %callback_arg)
9 declare i32 @custom_fun_two_callbacks(
10 i8 (i32, double)* %callback_arg1,
12 i8 (i32, double)* %callback_arg2
15 declare i8 @a_callback_fun(i32, double)
17 ; CHECK-LABEL: @"dfs$call_custom_funs_with_callbacks"
18 define void @call_custom_funs_with_callbacks(i8 (i32, double)* %callback_arg) {
19 ;; The callback should have attribute 'nonnull':
20 ; CHECK: call signext i32 @__dfsw_custom_fun_one_callback(
21 ; CHECK: nonnull @"dfst0$custom_fun_one_callback"
22 %call1 = call signext i32 @custom_fun_one_callback(
23 i8 (i32, double)* nonnull @a_callback_fun
26 ;; Call a custom function with two callbacks. Check their annotations.
27 ; CHECK: call i32 @__dfsw_custom_fun_two_callbacks(
28 ; CHECK: nonnull @"dfst0$custom_fun_two_callbacks"
30 ; CHECK: noalias @"dfst2$custom_fun_two_callbacks"
31 %call2 = call i32 @custom_fun_two_callbacks(
32 i8 (i32, double)* nonnull @a_callback_fun,
34 i8 (i32, double)* noalias @a_callback_fun