blob: 7a37da74271611122650db2fcaf43241212ec494 [file] [log] [blame]
Dan Gohman5bb7c7c2009-09-08 22:34:10 +00001; RUN: opt %s -globalopt -S | not grep global
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002
Tanya Lattner4c4d0b82008-03-01 09:15:35 +00003@G = internal global i32* null ; <i32**> [#uses=3]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00004
Tanya Lattner4c4d0b82008-03-01 09:15:35 +00005define void @init() {
6 %P = malloc i32 ; <i32*> [#uses=1]
7 store i32* %P, i32** @G
8 %GV = load i32** @G ; <i32*> [#uses=1]
9 store i32 0, i32* %GV
10 ret void
Dan Gohmanf17a25c2007-07-18 16:29:46 +000011}
12
Tanya Lattner4c4d0b82008-03-01 09:15:35 +000013define i32 @get() {
14 %GV = load i32** @G ; <i32*> [#uses=1]
15 %V = load i32* %GV ; <i32> [#uses=1]
16 ret i32 %V
Dan Gohmanf17a25c2007-07-18 16:29:46 +000017}
Tanya Lattner4c4d0b82008-03-01 09:15:35 +000018