summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/ThinLTOBitcodeWriter/function-alias.ll
diff options
context:
space:
mode:
authorVlad Tsyrklevich <vlad@tsyrklevich.net>2018-01-10 00:00:51 +0000
committerVlad Tsyrklevich <vlad@tsyrklevich.net>2018-01-10 00:00:51 +0000
commitcdec22ef9a418c971752c0854ebdddf0018dc260 (patch)
treed72c94e5856559617f2cae75df337f0301e8f1e8 /llvm/test/Transforms/ThinLTOBitcodeWriter/function-alias.ll
parent8d146bbc0cb3fcd00d036354da3fc00777450f0d (diff)
downloadbcm5719-llvm-cdec22ef9a418c971752c0854ebdddf0018dc260.tar.gz
bcm5719-llvm-cdec22ef9a418c971752c0854ebdddf0018dc260.zip
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
Diffstat (limited to 'llvm/test/Transforms/ThinLTOBitcodeWriter/function-alias.ll')
-rw-r--r--llvm/test/Transforms/ThinLTOBitcodeWriter/function-alias.ll25
1 files changed, 25 insertions, 0 deletions
diff --git a/llvm/test/Transforms/ThinLTOBitcodeWriter/function-alias.ll b/llvm/test/Transforms/ThinLTOBitcodeWriter/function-alias.ll
new file mode 100644
index 00000000000..119b8219bab
--- /dev/null
+++ b/llvm/test/Transforms/ThinLTOBitcodeWriter/function-alias.ll
@@ -0,0 +1,25 @@
+; 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"}
OpenPOWER on IntegriCloud