llvm/llvm/test/Transforms/GlobalOpt/basictest.ll

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=globalopt -S | FileCheck %s

@X = internal global i32 4              ; <ptr> [#uses=1]

define i32 @foo() {
; CHECK-LABEL: define i32 @foo() local_unnamed_addr {
; CHECK-NEXT:    ret i32 4
;
  %V = load i32, ptr @X               ; <i32> [#uses=1]
  ret i32 %V
}

@X_tls = internal thread_local global i32 13

define i32 @bar() {
; CHECK-LABEL: define i32 @bar() local_unnamed_addr {
; CHECK-NEXT:    ret i32 13
;
  %p = call ptr @llvm.threadlocal.address(ptr @X_tls)
  %v = load i32, ptr %p
  ret i32 %v
}