mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-07 03:26:53 +00:00
df6ad35dda
Summary: We were doing an optimization in the ThinLTO backends of importing constant unnamed_addr globals unconditionally as a local copy (regardless of whether the thin link decided to import them). This should be done in the thin link instead, so that resulting exported references are marked and promoted appropriately, but will need a summary enhancement to mark these variables as constant unnamed_addr. The function import logic during the thin link was trying to handle this proactively, by conservatively marking all values referenced in the initializer lists of exported global variables as also exported. However, this only handled values referenced directly from the initializer list of an exported global variable. If the value is itself a constant unnamed_addr variable, we could end up exporting its references as well. This caused multiple issues. The first is that the transitively exported references weren't promoted. Secondly, some could not be promoted/renamed (e.g. they had a section or other constraint). recursively, instead of just adding the first level of initializer list references to the ExportList directly. Remove this optimization and the associated handling in the function import backend. SPEC measurements indicate we weren't getting much from it in any case. Fixes PR31052. Reviewers: mehdi_amini Subscribers: krasin, llvm-commits Differential Revision: https://reviews.llvm.org/D26880 llvm-svn: 288446
29 lines
927 B
LLVM
29 lines
927 B
LLVM
; RUN: opt -module-summary %s -o %t1.bc
|
|
; RUN: opt -module-summary %p/Inputs/reference_non_importable.ll -o %t2.bc
|
|
|
|
; RUN: llvm-lto2 %t1.bc %t2.bc -o %t.o -save-temps \
|
|
; RUN: -r=%t1.bc,_foo,pxl \
|
|
; RUN: -r=%t1.bc,_b,pxl \
|
|
; RUN: -r=%t2.bc,_main,pxl \
|
|
; RUN: -r=%t2.bc,_foo,xl
|
|
|
|
|
|
|
|
|
|
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
|
|
target triple = "x86_64-apple-macosx10.11.0"
|
|
|
|
; We shouldn't promote the private because it has a section
|
|
; RUN: llvm-dis < %t.o.0.2.internalize.bc | FileCheck %s --check-prefix=PROMOTE
|
|
; PROMOTE: @a = private global i8 0, section "__TEXT,__cstring,cstring_literals"
|
|
@a = private global i8 0, section "__TEXT,__cstring,cstring_literals"
|
|
@b = global i8 *@a
|
|
|
|
|
|
; We want foo to be imported in the main module!
|
|
; RUN: llvm-dis < %t.o.1.3.import.bc | FileCheck %s --check-prefix=IMPORT
|
|
; IMPORT: define available_externally i8** @foo()
|
|
define i8 **@foo() {
|
|
ret i8 **@b
|
|
}
|