1 ; RUN: opt < %s -passes=globalopt -S | FileCheck %s
3 ; globalopt should not sra the global, because it can't see the index.
5 %struct.X = type { [3 x i32], [3 x i32] }
7 ; CHECK: @Y = internal unnamed_addr global [3 x %struct.X] zeroinitializer
8 @Y = internal global [3 x %struct.X] zeroinitializer
10 @addr = external global i8
13 store i32 1, ptr getelementptr inbounds ([3 x %struct.X], ptr @Y, i64 0, i64 0, i32 0, i64 ptrtoint (ptr @addr to i64)), align 4
20 ; CHECK: add i32 %a, %b
21 define i32 @borf(i64 %i, i64 %j) {
23 %q = getelementptr inbounds [3 x %struct.X], ptr @Y, i64 0, i64 0, i32 1, i64 0
32 ; CHECK: add i32 %a, %b
33 define i32 @borg(i64 %i, i64 %j) {
34 %p = getelementptr inbounds [3 x %struct.X], ptr @Y, i64 0, i64 1, i32 0, i64 1
36 %q = getelementptr inbounds [3 x %struct.X], ptr @Y, i64 0, i64 1, i32 1, i64 1
45 ; CHECK: add i32 %a, %b
46 define i32 @borh(i64 %i, i64 %j) {
47 %p = getelementptr inbounds [3 x %struct.X], ptr @Y, i64 0, i64 2, i32 0, i64 2
49 %q = getelementptr inbounds [3 x %struct.X], ptr @Y, i64 0, i64 2, i32 1, i64 2