blob: 4e4168a87d5b5b72cb7ee9a54e6a1294c46151cb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
/* Call the caller of __builtin_dispatch indirectly. Specify the
feature test function as a function pointer. Make sure cloning
still happens. */
/* { dg-do run } */
/* { dg-options "-O2 -fclone-hot-version-paths -fdump-tree-final_cleanup" } */
int __attribute__ ((version_selector))
featureTest ()
{
return 1;
}
int __attribute__ ((cold))
foo ()
{
return 0;
}
int __attribute__ ((cold))
bar ()
{
return 1;
}
int
dispatch ()
{
int (*funcp)() = featureTest;
int ret = __builtin_dispatch (funcp, (void *)foo, (void *)bar);
return ret;
}
int main (int argc, char **argv)
{
int (*ptr)() = dispatch;
return (*ptr)();
}
/* { dg-final { scan-tree-dump "dispatchv_clone_0" "final_cleanup" } } */
/* { dg-final { scan-tree-dump "dispatchv_clone_1" "final_cleanup" } } */
/* { dg-final { scan-tree-dump "main_clone_0" "final_cleanup" } } */
/* { dg-final { scan-tree-dump "main_clone_1" "final_cleanup" } } */
/* { dg-final { cleanup-tree-dump "final_cleanup" } } */
|