1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00
llvm-mirror/test/Analysis/CallGraph/callback-calls.ll
Sergey Dmitriev 1b3aa514d1 [CallGraph] Add support for callback call sites
Summary:
This patch changes call graph analysis to recognize callback call sites
and add an artificial 'reference' call record from the broker function
caller to the callback function in the call graph. A presence of such
reference enforces bottom-up traversal order for callback functions in
CG SCC pass manager because callback function logically becomes a callee
of the broker function caller.

Reviewers: jdoerfert, hfinkel, sstefan1, baziotis

Reviewed By: jdoerfert

Subscribers: hiraditya, kuter, sstefan1, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D82572
2020-07-01 13:44:11 -07:00

21 lines
545 B
LLVM

; RUN: opt < %s -print-callgraph -disable-output 2>&1 | FileCheck %s
; RUN: opt < %s -passes=print-callgraph -disable-output 2>&1 | FileCheck %s
; CHECK: Call graph node for function: 'caller'
; CHECK-NEXT: CS<{{.*}}> calls function 'broker'
; CHECK-NEXT: CS<None> calls function 'callback'
define void @caller(i32* %arg) {
call void @broker(void (i32*)* @callback, i32* %arg)
ret void
}
define void @callback(i32* %arg) {
ret void
}
declare !callback !0 void @broker(void (i32*)*, i32*)
!0 = !{!1}
!1 = !{i64 0, i64 1, i1 false}