blob: d4b4d5491c1458182593342910918e28f3eae71e [file] [log] [blame]
Volodymyr Sapsai88872142017-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
Teresa Johnsone3937752019-01-11 18:31:57 +00008; CHECK-NEXT: <FLAGS
Volodymyr Sapsai3c60df72017-11-17 18:28:05 +00009; "op7" is a call to "callee" function.
Eugene Levianta3f1de92018-11-16 07:08:00 +000010; CHECK-NEXT: <PERMODULE {{.*}} op8=3 op9=[[ALIASID:[0-9]+]]/>
Volodymyr Sapsai3c60df72017-11-17 18:28:05 +000011; "another_caller" has only references but no calls.
Eugene Levianta3f1de92018-11-16 07:08:00 +000012; CHECK-NEXT: <PERMODULE {{.*}} op4=3 {{.*}} op8={{[0-9]+}}/>
Volodymyr Sapsai88872142017-11-10 00:47:47 +000013; CHECK-NEXT: <PERMODULE {{.*}} op0=[[ALIASEEID:[0-9]+]]
14; CHECK-NEXT: <ALIAS {{.*}} op0=[[ALIASID]] {{.*}} op2=[[ALIASEEID]]/>
15; CHECK-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
16
17; ModuleID = 'thinlto-function-summary-callgraph-cast.ll'
18target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
19target triple = "x86_64-unknown-linux-gnu"
20
21define void @caller() {
22 call void bitcast (void (...)* @callee to void ()*)()
23 call void bitcast (void (...)* @analias to void ()*)()
24 ret void
25}
26
Volodymyr Sapsai3c60df72017-11-17 18:28:05 +000027define void @another_caller() {
28 ; Test calls that aren't handled either as direct or indirect.
29 call void select (i1 icmp eq (i32* @global, i32* null), void ()* @f, void ()* @g)()
30 ret void
31}
32
Volodymyr Sapsai88872142017-11-10 00:47:47 +000033declare void @callee(...)
34
35@analias = alias void (...), bitcast (void ()* @aliasee to void (...)*)
36
37define void @aliasee() {
38entry:
39 ret void
40}
Volodymyr Sapsai3c60df72017-11-17 18:28:05 +000041
42declare void @f()
43declare void @g()
44@global = extern_weak global i32