1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals
2 ; RUN: opt -S -passes=globalopt < %s | FileCheck %s
4 ; The store here writes into the padding after [5 x i8].
5 ; Make sure we don't crash.
7 %T = type { [5 x i8], i16 }
9 @g = global %T zeroinitializer
11 @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @ctor, ptr null }]
14 ; CHECK: @[[G:[a-zA-Z0-9_$"\\.-]+]] = local_unnamed_addr global [[T:%.*]] zeroinitializer
15 ; CHECK: @[[LLVM_GLOBAL_CTORS:[a-zA-Z0-9_$"\\.-]+]] = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @ctor, ptr null }]
17 define internal void @ctor() {
19 ; CHECK-NEXT: store i8 0, ptr getelementptr inbounds ([[T:%.*]], ptr @g, i64 0, i32 0, i64 5), align 1
20 ; CHECK-NEXT: ret void
22 store i8 0, ptr getelementptr inbounds (%T, ptr @g, i64 0, i32 0, i64 5)