mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-04 03:56:07 +00:00

This adds support for a HasTailCall flag on function call edges in the ThinLTO summary. It is intended for use in aiding discovery of missing frames from tail calls in profiled call stacks for MemProf of profiled binaries that did not disable tail call elimination. A follow on change will add the use of this new flag during MemProf context disambiguation. The new flag is encoded in the bitcode along with either the hotness flag from the profile, or the relative block frequency under the -write-relbf-to-summary flag when there is no profile data. Because we now will always have some additional call edge information, I have removed the non-profile function summary record format, and we simply encode the tail call flag along with a hotness type of none when there is no profile information or relative block frequency. The change of record format and name caused most of the test case changes. I have added explicit testing of generation of the new tail call flag into the bitcode and IR assembly format as part of the changes to llvm/test/Bitcode/thinlto-function-summary-refgraph.ll. I have also added round trip testing through assembly and bitcode to llvm/test/Assembler/thinlto-summary.ll.
45 lines
1.2 KiB
LLVM
45 lines
1.2 KiB
LLVM
; Test to check the callgraph for calls to casts.
|
|
; RUN: opt -module-summary %s -o %t.o
|
|
; RUN: llvm-bcanalyzer -dump %t.o | FileCheck %s
|
|
; PR34966
|
|
|
|
; CHECK: <GLOBALVAL_SUMMARY_BLOCK
|
|
; CHECK-NEXT: <VERSION
|
|
; CHECK-NEXT: <FLAGS
|
|
; "op7" is a call to "callee" function.
|
|
; CHECK-NEXT: <PERMODULE_PROFILE {{.*}} op7=3 op8=0 op9=[[ALIASID:[0-9]+]]
|
|
; "another_caller" has only references but no calls.
|
|
; CHECK-NEXT: <PERMODULE_PROFILE {{.*}}/>
|
|
; CHECK-NEXT: <PERMODULE_PROFILE {{.*}} op0=[[ALIASEEID:[0-9]+]]
|
|
; CHECK-NEXT: <ALIAS {{.*}} op0=[[ALIASID]] {{.*}} op2=[[ALIASEEID]]/>
|
|
; CHECK-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
|
|
|
|
; ModuleID = 'thinlto-function-summary-callgraph-cast.ll'
|
|
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
|
target triple = "x86_64-unknown-linux-gnu"
|
|
|
|
define void @caller() {
|
|
call void @callee()
|
|
call void @analias()
|
|
ret void
|
|
}
|
|
|
|
define void @another_caller() {
|
|
; Test calls that aren't handled either as direct or indirect.
|
|
call void getelementptr (i8, ptr @f, i64 ptrtoint (ptr @g to i64))()
|
|
ret void
|
|
}
|
|
|
|
declare void @callee(...)
|
|
|
|
@analias = alias void (...), ptr @aliasee
|
|
|
|
define void @aliasee() {
|
|
entry:
|
|
ret void
|
|
}
|
|
|
|
declare void @f()
|
|
declare void @g()
|
|
@global = extern_weak global i32
|