Skip to content

ConstantMerge drops thread_local from global #49276

@Amanieu

Description

@Amanieu
Bugzilla Link 49932
Resolution FIXED
Resolved on Jun 23, 2021 07:59
Version trunk
OS Linux
Blocks #48661 #50032
CC @tstellar
Fixed by commit(s) ad9ce81 0eae129

Extended Description

Note that in the example below the address of @​tls_var is significant (it is not unnamed_addr): it should be different on every thread when the function is called.

$ cat test.ll

@​tls_var = private thread_local constant i32 222, align 4
@​const = private unnamed_addr constant i32 222, align 4

define void @​main() {
start:
call void @​external(i32* @​const, i32* @​tls_var)
ret void
}

declare void @​external(i32*, i32*)

$ opt -O3 -S test.ll

; ModuleID = 'test.ll'
source_filename = "test.ll"

@​const = private constant i32 222, align 4

define void @​main() local_unnamed_addr {
start:
tail call void @​external(i32* nonnull @​const, i32* nonnull @​const)
ret void
}

declare void @​external(i32*, i32*) local_unnamed_addr

Metadata

Metadata

Assignees

Labels

bugzillaIssues migrated from bugzillaipoInterprocedural optimizations

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions