blob: fd510e3b57129354473427aad699bcb86ab73ce0 [file] [log] [blame]
Dan Gohman3c7d3082009-09-11 18:01:28 +00001; RUN: opt < %s -globalopt -S | not grep global
Kenneth Uildriksa092c122009-11-03 15:29:06 +00002target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
Dan Gohmanf17a25c2007-07-18 16:29:46 +00003
Tanya Lattner4c4d0b82008-03-01 09:15:35 +00004@G = internal global i32* null ; <i32**> [#uses=3]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00005
Tanya Lattner4c4d0b82008-03-01 09:15:35 +00006define void @init() {
7 %P = malloc i32 ; <i32*> [#uses=1]
8 store i32* %P, i32** @G
9 %GV = load i32** @G ; <i32*> [#uses=1]
10 store i32 0, i32* %GV
11 ret void
Dan Gohmanf17a25c2007-07-18 16:29:46 +000012}
13
Tanya Lattner4c4d0b82008-03-01 09:15:35 +000014define i32 @get() {
15 %GV = load i32** @G ; <i32*> [#uses=1]
16 %V = load i32* %GV ; <i32> [#uses=1]
17 ret i32 %V
Dan Gohmanf17a25c2007-07-18 16:29:46 +000018}
Tanya Lattner4c4d0b82008-03-01 09:15:35 +000019