1; RUN: opt -lowertypetests -lowertypetests-summary-action=import -lowertypetests-read-summary=%p/Inputs/cfi-direct-call.yaml %s -S | FileCheck %s 2 3target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 4target triple = "x86_64-unknown-linux" 5 6declare void @external_decl() 7declare void @external_nodecl() 8;declare void @internal_default_def() 9declare hidden void @internal_hidden_def() 10 11define 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() 17 call void @local_b() 18 ret i8 1 19} 20 21define dso_local void @dsolocal_default_def() { 22 ret void 23} 24 25define void @internal_default_def() { 26 ret void 27} 28 29define void @local_b() { 30 ret void 31} 32 33; CHECK: define i8 @local_a() { 34 35; Even though a jump table entry is generated, the call goes directly 36; to the function 37; CHECK-NEXT: call void @external_decl() 38 39; External call with no CFI decl - no action 40; CHECK-NEXT: call void @external_nodecl() 41 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() 45 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() 50 51; dso_local function with defailt visibility can be short-circuited 52; CHECK-NEXT: call void @dsolocal_default_def.cfi() 53 54; Local call - no action 55; CHECK-NEXT: call void @local_b 56 57; CHECK-NEXT: ret i8 1 58 59; CHECK: declare hidden void @internal_hidden_def.cfi() 60; CHECK: declare hidden void @external_decl.cfi_jt() 61