1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

[ConstantMerge] Don't merge thread_local constants with non-thread_local constants

Fixes PR49932

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D100322
This commit is contained in:
Amanieu d'Antras 2021-04-12 18:05:18 +01:00
parent f82baca8ab
commit 4664202d6c
2 changed files with 14 additions and 0 deletions

View File

@ -95,6 +95,8 @@ isUnmergeableGlobal(GlobalVariable *GV,
// Only process constants with initializers in the default address space.
return !GV->isConstant() || !GV->hasDefinitiveInitializer() ||
GV->getType()->getAddressSpace() != 0 || GV->hasSection() ||
// Don't touch thread-local variables.
GV->isThreadLocal() ||
// Don't touch values marked with attribute(used).
UsedGlobals.count(GV);
}

View File

@ -80,3 +80,15 @@ define void @test4(i32** %P1, i32** %P2, i32** %P3, i32** %P4, i32** %P5, i32**
store i32* @T4D2, i32** %P8
ret void
}
; CHECK: @T5tls
; CHECK: @T5ua
@T5tls = private thread_local constant i32 555
@T5ua = private unnamed_addr constant i32 555
define void @test5(i32** %P1, i32** %P2) {
store i32* @T5tls, i32** %P1
store i32* @T5ua, i32** %P2
ret void
}