reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    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
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
; RUN: opt -lowertypetests -lowertypetests-summary-action=import -lowertypetests-read-summary=%p/Inputs/cfi-direct-call.yaml %s -S | FileCheck %s

target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux"

declare void @external_decl()
declare void @external_nodecl()
;declare void @internal_default_def()
declare hidden void @internal_hidden_def()

define i8 @local_a() {
  call void @external_decl()
  call void @external_nodecl()
  call void @internal_default_def()
  call void @internal_hidden_def()
  call void @dsolocal_default_def()
  call void @local_b()
  ret i8 1
}

define dso_local void @dsolocal_default_def() {
  ret void
}

define void @internal_default_def() {
  ret void
}

define void @local_b() {
  ret void
}

; CHECK: define i8 @local_a() {

; Even though a jump table entry is generated, the call goes directly
; to the function
; CHECK-NEXT:   call void @external_decl()

; External call with no CFI decl - no action
; CHECK-NEXT:   call void @external_nodecl()

; Internal function with default visibility gets routed through the jump table
; as it may be overriden at run time.
; CHECK-NEXT:   call void @internal_default_def()

; Internal function with hidden visibility defined outside the module
; generates a jump table entry and is renamed to *.cfi: route direct call
; to the actual function, not jump table
; CHECK-NEXT:   call void @internal_hidden_def.cfi()

; dso_local function with defailt visibility can be short-circuited
; CHECK-NEXT:   call void @dsolocal_default_def.cfi()

; Local call - no action
; CHECK-NEXT:   call void @local_b

; CHECK-NEXT:   ret i8 1

; CHECK: declare hidden void @internal_hidden_def.cfi()
; CHECK: declare hidden void @external_decl.cfi_jt()