1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
llvm-mirror/test/Transforms/NameAnonGlobals/rename.ll
Teresa Johnson 8d9ed1ced3 [ThinLTO] Ensure anonymous globals renamed even at -O0
Summary:
This fixes an issue when files are compiled with -flto=thin
at default -O0. We need to rename anonymous globals before attempting
to write the module summary because all values need names for
the summary. This was happening at -O1 and above, but not before
the early exit when constructing the pipeline for -O0.

Also add an internal -prepare-for-thinlto option to enable this
to be tested via opt.

Fixes PR30419.

Reviewers: mehdi_amini

Subscribers: probinson, llvm-commits, mehdi_amini

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

llvm-svn: 281840
2016-09-17 20:40:16 +00:00

35 lines
840 B
LLVM

; RUN: opt -S -name-anon-globals < %s | FileCheck %s
; RUN: opt -prepare-for-thinlto -O0 -module-summary -o %t.bc < %s
; foo contribute to the unique hash for the module
define void @foo() {
ret void
}
; bar is internal, and does not contribute to the unique hash for the module
define internal void @bar() {
ret void
}
; CHECK: @anon.acbd18db4cc2f85cedef654fccc4a4d8.3 = global i8 0
; CHECK: @anon.acbd18db4cc2f85cedef654fccc4a4d8.4 = alias i8, i8* @anon.acbd18db4cc2f85cedef654fccc4a4d8.3
; CHECK: define void @anon.acbd18db4cc2f85cedef654fccc4a4d8.0()
; CHECK: define void @anon.acbd18db4cc2f85cedef654fccc4a4d8.1()
; CHECK: define void @anon.acbd18db4cc2f85cedef654fccc4a4d8.2()
define void @0() {
ret void
}
define void @1() {
ret void
}
define void @2() {
ret void
}
@3 = global i8 0
@4 = alias i8, i8 *@3