mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-19 15:13:49 -04:00
[ThinLTO] Fix missing call graph edges for calls with bitcasts.
This change doesn't fix the root cause of the miscompile PR34966 as the root cause is in the linker ld64. This change makes call graph more complete allowing to have better module imports/exports. rdar://problem/35344706 Reviewers: tejohnson Reviewed By: tejohnson Subscribers: mehdi_amini, inglorion, eraman, llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D39356 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317853 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -243,6 +243,11 @@ computeFunctionSummary(ModuleSummaryIndex &Index, const Module &M,
|
||||
|
||||
auto *CalledValue = CS.getCalledValue();
|
||||
auto *CalledFunction = CS.getCalledFunction();
|
||||
if (CalledValue && !CalledFunction) {
|
||||
CalledValue = CalledValue->stripPointerCastsNoFollowAliases();
|
||||
// Stripping pointer casts can reveal a called function.
|
||||
CalledFunction = dyn_cast<Function>(CalledValue);
|
||||
}
|
||||
// Check if this is an alias to a function. If so, get the
|
||||
// called aliasee for the checks below.
|
||||
if (auto *GA = dyn_cast<GlobalAlias>(CalledValue)) {
|
||||
@@ -275,9 +280,8 @@ computeFunctionSummary(ModuleSummaryIndex &Index, const Module &M,
|
||||
// Skip inline assembly calls.
|
||||
if (CI && CI->isInlineAsm())
|
||||
continue;
|
||||
// Skip direct calls.
|
||||
if (!CS.getCalledValue() || isa<Constant>(CS.getCalledValue()))
|
||||
continue;
|
||||
assert(CalledValue && !isa<Constant>(CalledValue) &&
|
||||
"Expected indirect call");
|
||||
|
||||
uint32_t NumVals, NumCandidates;
|
||||
uint64_t TotalCount;
|
||||
|
||||
Reference in New Issue
Block a user