blob: 45801c9a74dd20a9961c477f5840c441a2ceda12 [file] [log] [blame]
Volodymyr Sapsaia7396022017-11-10 00:47:47 +00001; Test to check the callgraph for calls to casts.
2; RUN: opt -module-summary %s -o %t.o
3; RUN: llvm-bcanalyzer -dump %t.o | FileCheck %s
4; PR34966
5
6; CHECK: <GLOBALVAL_SUMMARY_BLOCK
7; CHECK-NEXT: <VERSION
Volodymyr Sapsai8b46ff12017-11-17 18:28:05 +00008; "op7" is a call to "callee" function.
9; CHECK-NEXT: <PERMODULE {{.*}} op7=3 op8=[[ALIASID:[0-9]+]]/>
10; "another_caller" has only references but no calls.
11; CHECK-NEXT: <PERMODULE {{.*}} op4=3 {{.*}} op7={{[0-9]+}}/>
Volodymyr Sapsaia7396022017-11-10 00:47:47 +000012; CHECK-NEXT: <PERMODULE {{.*}} op0=[[ALIASEEID:[0-9]+]]
13; CHECK-NEXT: <ALIAS {{.*}} op0=[[ALIASID]] {{.*}} op2=[[ALIASEEID]]/>
14; CHECK-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
15
16; ModuleID = 'thinlto-function-summary-callgraph-cast.ll'
17target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
18target triple = "x86_64-unknown-linux-gnu"
19
20define void @caller() {
21 call void bitcast (void (...)* @callee to void ()*)()
22 call void bitcast (void (...)* @analias to void ()*)()
23 ret void
24}
25
Volodymyr Sapsai8b46ff12017-11-17 18:28:05 +000026define void @another_caller() {
27 ; Test calls that aren't handled either as direct or indirect.
28 call void select (i1 icmp eq (i32* @global, i32* null), void ()* @f, void ()* @g)()
29 ret void
30}
31
Volodymyr Sapsaia7396022017-11-10 00:47:47 +000032declare void @callee(...)
33
34@analias = alias void (...), bitcast (void ()* @aliasee to void (...)*)
35
36define void @aliasee() {
37entry:
38 ret void
39}
Volodymyr Sapsai8b46ff12017-11-17 18:28:05 +000040
41declare void @f()
42declare void @g()
43@global = extern_weak global i32