blob: 9a068e948941926777a8fb29a0e4b80f49626d55 [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001; In this case, the global can only be broken up by one level.
2
Dan Gohman3c7d3082009-09-11 18:01:28 +00003; RUN: opt < %s -globalopt -S | not grep 12345
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004
Tanya Lattner4c4d0b82008-03-01 09:15:35 +00005@G = internal global { i32, [4 x float] } zeroinitializer ; <{ i32, [4 x float] }*> [#uses=3]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00006
Tanya Lattner4c4d0b82008-03-01 09:15:35 +00007define void @onlystore() {
8 store i32 12345, i32* getelementptr ({ i32, [4 x float] }* @G, i32 0, i32 0)
9 ret void
Dan Gohmanf17a25c2007-07-18 16:29:46 +000010}
11
Tanya Lattner4c4d0b82008-03-01 09:15:35 +000012define void @storeinit(i32 %i) {
13 %Ptr = getelementptr { i32, [4 x float] }* @G, i32 0, i32 1, i32 %i ; <float*> [#uses=1]
14 store float 1.000000e+00, float* %Ptr
15 ret void
Dan Gohmanf17a25c2007-07-18 16:29:46 +000016}
17
Tanya Lattner4c4d0b82008-03-01 09:15:35 +000018define float @readval(i32 %i) {
19 %Ptr = getelementptr { i32, [4 x float] }* @G, i32 0, i32 1, i32 %i ; <float*> [#uses=1]
20 %V = load float* %Ptr ; <float> [#uses=1]
21 ret float %V
Dan Gohmanf17a25c2007-07-18 16:29:46 +000022}
23