llvm/llvm/test/Transforms/GlobalOpt/stored-once-different-type.ll

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

@g = internal global [4 x i8] undef

;.
; CHECK: @[[G:[a-zA-Z0-9_$"\\.-]+]] = internal unnamed_addr constant i32 42
;.
define void @store() {
; CHECK-LABEL: @store(
; CHECK-NEXT:    ret void
;
  store i32 42, ptr @g
  ret void
}

define i32 @load1() {
; CHECK-LABEL: @load1(
; CHECK-NEXT:    ret i32 42
;
  %v = load i32, ptr @g
  ret i32 %v
}

define i16 @load2() {
; CHECK-LABEL: @load2(
; CHECK-NEXT:    ret i16 42
;
  %v = load i16, ptr @g
  ret i16 %v
}

define [4 x i8] @load3() {
; CHECK-LABEL: @load3(
; CHECK-NEXT:    [[V:%.*]] = load [4 x i8], ptr @g, align 1
; CHECK-NEXT:    ret [4 x i8] [[V]]
;
  %v = load [4 x i8], ptr @g
  ret [4 x i8] %v
}