mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
69b4df22e0
Summary: We hit undefined references building with ThinLTO when one source file contained explicit instantiations of a template method (weak_odr) but there were also implicit instantiations in another file (linkonce_odr), and the latter was the prevailing copy. In this case the symbol was marked hidden when the prevailing linkonce_odr copy was promoted to weak_odr. It led to unsats when the resulting shared library was linked with other code that contained a reference (expecting to be resolved due to the explicit instantiation). Add a CanAutoHide flag to the GV summary to allow the thin link to identify when all copies are eligible for auto-hiding (because they were all originally linkonce_odr global unnamed addr), and only do the auto-hide in that case. Most of the changes here are due to plumbing the new flag through the bitcode and llvm assembly, and resulting test changes. I augmented the existing auto-hide test to check for this situation. Reviewers: pcc Subscribers: mehdi_amini, inglorion, eraman, dexonsmith, arphaman, dang, llvm-commits, steven_wu, wmi Tags: #llvm Differential Revision: https://reviews.llvm.org/D59709 llvm-svn: 360466
44 lines
1.7 KiB
LLVM
44 lines
1.7 KiB
LLVM
; Test to check the callgraph in summary
|
|
; RUN: opt -write-relbf-to-summary -module-summary %s -o %t.o
|
|
; RUN: llvm-bcanalyzer -dump %t.o | FileCheck %s
|
|
; RUN: llvm-dis -o - %t.o | FileCheck %s --check-prefix=DIS
|
|
; Round trip it through llvm-as
|
|
; RUN: llvm-dis -o - %t.o | llvm-as -write-relbf-to-summary -o - | llvm-dis -o - | FileCheck %s --check-prefix=DIS
|
|
|
|
; CHECK: <SOURCE_FILENAME
|
|
; CHECK-NEXT: <GLOBALVAR
|
|
; CHECK-NEXT: <FUNCTION
|
|
; "func"
|
|
; CHECK-NEXT: <FUNCTION op0=17 op1=4
|
|
; CHECK: <GLOBALVAL_SUMMARY_BLOCK
|
|
; CHECK-NEXT: <VERSION
|
|
; CHECK-NEXT: <FLAGS
|
|
; See if the call to func is registered.
|
|
; CHECK-NEXT: <PERMODULE_RELBF {{.*}} op4=1 {{.*}} op8=256
|
|
; CHECK-NEXT: </GLOBALVAL_SUMMARY_BLOCK>
|
|
; CHECK: <STRTAB_BLOCK
|
|
; CHECK-NEXT: blob data = 'undefinedglobmainfunc{{.*}}'
|
|
|
|
|
|
; ModuleID = 'thinlto-function-summary-callgraph.ll'
|
|
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
|
target triple = "x86_64-unknown-linux-gnu"
|
|
|
|
; Function Attrs: nounwind uwtable
|
|
define i32 @main() #0 {
|
|
entry:
|
|
call void (...) @func()
|
|
%u = load i32, i32* @undefinedglob
|
|
ret i32 %u
|
|
}
|
|
|
|
declare void @func(...) #1
|
|
@undefinedglob = external global i32
|
|
|
|
; OLD: Index {{.*}} contains 1 nodes (1 functions, 0 alias, 0 globals) and 1 edges (0 refs and 1 calls)
|
|
|
|
; DIS: ^0 = module: (path: "{{.*}}", hash: (0, 0, 0, 0, 0))
|
|
; DIS: ^1 = gv: (name: "func") ; guid = 7289175272376759421
|
|
; DIS: ^2 = gv: (name: "main", summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), insts: 3, calls: ((callee: ^1, relbf: 256)), refs: (readonly ^3)))) ; guid = 15822663052811949562
|
|
; DIS: ^3 = gv: (name: "undefinedglob") ; guid = 18036901804029949403
|