1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
llvm-mirror/test/Transforms/ThinLTOBitcodeWriter/function-alias.ll
Vlad Tsyrklevich 7f72d85310 LowerTypeTests: Add limited support for aliases
Summary:
LowerTypeTests moves some function definitions from individual object
files to the merged module, leaving a stub to be called in the merged
module's jump table. If an alias was pointing to such a function
definition LowerTypeTests would fail because the alias would be left
without a definition to point to.

This change 1) emits information about aliases to the ThinLTO summary,
2) replaces aliases pointing to function definitions that are moved to
the merged module with function declarations, and 3) re-emits those
aliases in the merged module pointing to the correct function
definitions.

The patch does not correctly fix all possible mis-uses of aliases in
LowerTypeTests. For example, it does not handle aliases with a different
type from the pointed to function.

The addition of alias data increases the size of Chrome build artifacts
by less than 1%.

Reviewers: pcc

Reviewed By: pcc

Subscribers: mehdi_amini, eraman, mgrang, llvm-commits, eugenis, kcc

Differential Revision: https://reviews.llvm.org/D41741

llvm-svn: 322139
2018-01-10 00:00:51 +00:00

26 lines
799 B
LLVM

; RUN: opt -thinlto-bc -o %t %s
; RUN: llvm-modextract -n 1 -o - %t | llvm-dis | FileCheck --check-prefix=CHECK1 %s
target triple = "x86_64-unknown-linux-gnu"
define hidden void @Func() !type !0 {
ret void
}
; CHECK1: !aliases = !{![[A1:[0-9]+]], ![[A2:[0-9]+]], ![[A3:[0-9]+]]}
; CHECK1: ![[A1]] = !{!"Alias", !"Func", i8 1, i8 0}
; CHECK1: ![[A2]] = !{!"Hidden_Alias", !"Func", i8 1, i8 0}
; CHECK1: ![[A3]] = !{!"Weak_Alias", !"Func", i8 0, i8 1}
@Alias = hidden alias void (), void ()* @Func
@Hidden_Alias = hidden alias void (), void ()* @Func
@Weak_Alias = weak alias void (), void ()* @Func
@Variable = global i32 0
; Only generate summary alias information for aliases to functions
; CHECK1-NOT: Variable_Alias
@Variable_Alias = alias i32, i32* @Variable
!0 = !{i64 0, !"_ZTSFvvE"}