59 lines · plain
1;; Test if temporary labels are generated for each indirect callsite.2;; Test if the .llvm.callgraph section contains the MD5 hash of callees' type (type id)3;; is correctly paired with its corresponding temporary label generated for indirect4;; call sites annotated with !callee_type metadata.5;; Test if the .llvm.callgraph section contains unique direct callees.6 7; RUN: llc -mtriple=x86_64-unknown-linux --call-graph-section -o - < %s | FileCheck %s8 9declare !type !0 void @direct_foo()10declare !type !1 i32 @direct_bar(i8)11declare !type !2 ptr @direct_baz(ptr)12 13; CHECK: ball:14define ptr @ball() {15entry:16 call void @direct_foo()17 %fp_foo_val = load ptr, ptr null, align 8 18 call void (...) %fp_foo_val(), !callee_type !0 19 call void @direct_foo()20 %fp_bar_val = load ptr, ptr null, align 8 21 %call_fp_bar = call i32 %fp_bar_val(i8 0), !callee_type !2 22 %call_fp_bar_direct = call i32 @direct_bar(i8 1)23 %fp_baz_val = load ptr, ptr null, align 824 %call_fp_baz = call ptr %fp_baz_val(ptr null), !callee_type !425 call void @direct_foo()26 %call_fp_baz_direct = call ptr @direct_baz(ptr null)27 call void @direct_foo()28 ret ptr %call_fp_baz29}30 31!0 = !{!1}32!1 = !{i64 0, !"_ZTSFvE.generalized"}33!2 = !{!3}34!3 = !{i64 0, !"_ZTSFicE.generalized"}35!4 = !{!5}36!5 = !{i64 0, !"_ZTSFPvS_E.generalized"}37 38; CHECK: .section .llvm.callgraph,"o",@llvm_call_graph,.text39;; Version40; CHECK-NEXT: .byte 041;; Flags42; CHECK-NEXT: .byte 743;; Function Entry PC44; CHECK-NEXT: .quad ball45;; Function type ID -- set to 0 as no type metadata attached to function.46; CHECK-NEXT: .quad 047;; Number of unique direct callees.48; CHECK-NEXT: .byte 349;; Direct callees.50; CHECK-NEXT: .quad direct_foo51; CHECK-NEXT: .quad direct_bar52; CHECK-NEXT: .quad direct_baz53;; Number of unique indirect target type IDs.54; CHECK-NEXT: .byte 355;; Indirect type IDs.56; CHECK-NEXT: .quad 452497298749648182857; CHECK-NEXT: .quad 349881697944184584458; CHECK-NEXT: .quad 864623395137132095459