Merging r258616:
[oota-llvm.git] / test / Transforms / GlobalOpt / ctor-list-opt-inbounds.ll
1 ; RUN: opt < %s -globalopt -S | FileCheck %s
2
3 ; Don't get fooled by the inbounds keyword; it doesn't change
4 ; the computed address.
5
6 ; CHECK: @H = global i32 2
7 ; CHECK: @I = global i32 2
8
9 @llvm.global_ctors = appending global [1 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @CTOR } ]
10 @addr = external global i32
11 @G = internal global [6 x [5 x i32]] zeroinitializer
12 @H = global i32 80
13 @I = global i32 90
14
15 define internal void @CTOR() {
16   store i32 1, i32* getelementptr ([6 x [5 x i32]], [6 x [5 x i32]]* @G, i64 0, i64 0, i64 0)
17   store i32 2, i32* getelementptr inbounds ([6 x [5 x i32]], [6 x [5 x i32]]* @G, i64 0, i64 0, i64 0)
18   %t = load i32, i32* getelementptr ([6 x [5 x i32]], [6 x [5 x i32]]* @G, i64 0, i64 0, i64 0)
19   store i32 %t, i32* @H
20   %s = load i32, i32* getelementptr inbounds ([6 x [5 x i32]], [6 x [5 x i32]]* @G, i64 0, i64 0, i64 0)
21   store i32 %s, i32* @I
22   ret void
23 }