mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-26 05:36:36 +00:00
Some optimizations done by globalopt are safe only for internal linkage, not
linkonce linkage. For example, it is not valid to add unnamed_addr. This also fixes a crash in g++.dg/opt/static5.C. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158528 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d628a587b6
commit
2f135d4c14
@ -1729,6 +1729,9 @@ bool GlobalOpt::ProcessGlobal(GlobalVariable *GV,
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!GV->hasLocalLinkage())
|
||||
return false;
|
||||
|
||||
SmallPtrSet<const PHINode*, 16> PHIUsers;
|
||||
GlobalStatus GS;
|
||||
|
||||
|
@ -4,11 +4,23 @@
|
||||
@b = internal global i32 0, align 4
|
||||
@c = internal global i32 0, align 4
|
||||
@d = internal constant [4 x i8] c"foo\00", align 1
|
||||
@e = linkonce_odr global i32 0
|
||||
|
||||
; CHECK: @a = internal global i32 0, align 4
|
||||
; CHECK: @b = internal global i32 0, align 4
|
||||
; CHECK: @c = internal unnamed_addr global i32 0, align 4
|
||||
; CHECK: @d = internal unnamed_addr constant [4 x i8] c"foo\00", align 1
|
||||
; CHECK: @e = linkonce_odr global i32 0
|
||||
|
||||
define i32 @get_e() {
|
||||
%t = load i32* @e
|
||||
ret i32 %t
|
||||
}
|
||||
|
||||
define void @set_e(i32 %x) {
|
||||
store i32 %x, i32* @e
|
||||
ret void
|
||||
}
|
||||
|
||||
define i1 @bah(i64 %i) nounwind readonly optsize ssp {
|
||||
entry:
|
||||
|
Loading…
x
Reference in New Issue
Block a user