1 ; RUN: opt -lowertypetests -lowertypetests-summary-action=import -lowertypetests-read-summary=%p/Inputs/cfi-direct-call.yaml %s -S | FileCheck %s
3 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
4 target triple = "x86_64-unknown-linux"
6 declare void @external_decl()
7 declare void @external_nodecl()
8 ;declare void @internal_default_def()
9 declare hidden void @internal_hidden_def()
11 define i8 @local_a() {
12 call void @external_decl()
13 call void @external_nodecl()
14 call void @internal_default_def()
15 call void @internal_hidden_def()
16 call void @dsolocal_default_def()
21 define dso_local void @dsolocal_default_def() {
25 define void @internal_default_def() {
29 define void @local_b() {
33 ; CHECK: define i8 @local_a() {
35 ; Even though a jump table entry is generated, the call goes directly
37 ; CHECK-NEXT: call void @external_decl()
39 ; External call with no CFI decl - no action
40 ; CHECK-NEXT: call void @external_nodecl()
42 ; Internal function with default visibility gets routed through the jump table
43 ; as it may be overriden at run time.
44 ; CHECK-NEXT: call void @internal_default_def()
46 ; Internal function with hidden visibility defined outside the module
47 ; generates a jump table entry and is renamed to *.cfi: route direct call
48 ; to the actual function, not jump table
49 ; CHECK-NEXT: call void @internal_hidden_def.cfi()
51 ; dso_local function with defailt visibility can be short-circuited
52 ; CHECK-NEXT: call void @dsolocal_default_def.cfi()
54 ; Local call - no action
55 ; CHECK-NEXT: call void @local_b
57 ; CHECK-NEXT: ret i8 1
59 ; CHECK: declare hidden void @internal_hidden_def.cfi()
60 ; CHECK: declare hidden void @external_decl.cfi_jt()