aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2023-12-06 08:41:44 -0800
committerGitHub <noreply@github.com>2023-12-06 08:41:44 -0800
commit88fbc4d3df7c24105eb36232ff6250da95c8a202 (patch)
tree4bc633dafcb36d16958bf88510d83b3d3ce7e913 /llvm/lib/IR
parent8186e1500b1d9709f10199b7c599274f8a6f8e3a (diff)
downloadllvm-88fbc4d3df7c24105eb36232ff6250da95c8a202.zip
llvm-88fbc4d3df7c24105eb36232ff6250da95c8a202.tar.gz
llvm-88fbc4d3df7c24105eb36232ff6250da95c8a202.tar.bz2
[ThinLTO] Add tail call flag to call edges in summary (#74043)
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.
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r--llvm/lib/IR/AsmWriter.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index c67c32a..bff64e3 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -3243,6 +3243,10 @@ void AssemblyWriter::printFunctionSummary(const FunctionSummary *FS) {
Out << ", hotness: " << getHotnessName(Call.second.getHotness());
else if (Call.second.RelBlockFreq)
Out << ", relbf: " << Call.second.RelBlockFreq;
+ // Follow the convention of emitting flags as a boolean value, but only
+ // emit if true to avoid unnecessary verbosity and test churn.
+ if (Call.second.HasTailCall)
+ Out << ", tail: 1";
Out << ")";
}
Out << ")";