Compiler projects using llvm
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -globalopt < %s | FileCheck %s

@g = internal global [8 x i8] undef

define void @test() {
; CHECK-LABEL: @test(
; CHECK-NEXT:    ret void
;
  store i32 1, i32* bitcast ([8 x i8]* @g to i32*)
  store i32 2, i32* getelementptr (i32, i32* bitcast ([8 x i8]* @g to i32*), i64 1)
  ret void
}

define i32 @load1() {
; CHECK-LABEL: @load1(
; CHECK-NEXT:    ret i32 1
;
  %v = load i32, i32* bitcast ([8 x i8]* @g to i32*)
  ret i32 %v
}

define i32 @load2() {
; CHECK-LABEL: @load2(
; CHECK-NEXT:    ret i32 2
;
  %v = load i32, i32* getelementptr (i32, i32* bitcast ([8 x i8]* @g to i32*), i64 1)
  ret i32 %v
}