[llvm-bugs] [Bug 49932] New: ConstantMerge drops thread_local from global

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Apr 12 05:44:42 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=49932

            Bug ID: 49932
           Summary: ConstantMerge drops thread_local from global
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Interprocedural Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: amanieu at gmail.com
                CC: llvm-bugs at lists.llvm.org

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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210412/0c836ea0/attachment.html>


More information about the llvm-bugs mailing list