1 ; RUN: opt -globalopt -S < %s | FileCheck %s
3 ; CHECK: section ".foo"
5 %struct.xyz = type { double, i32 }
7 @Y = internal global %struct.xyz* null ,section ".foo" ; <%struct.xyz**> [#uses=2]
8 @numf2s = external global i32 ; <i32*> [#uses=1]
10 define void @init_net() #0 {
11 ; CHECK-LABEL: init_net(
12 ; CHECK: load i32, i32* @numf2s
13 ; CHECK: call i8* @malloc
14 ; CHECK: store %struct.xyz* {{.*}}, %struct.xyz** @Y
16 %0 = load i32, i32* @numf2s, align 4 ; <i32> [#uses=1]
17 %mallocsize2 = shl i32 %0, 4 ; <i32> [#uses=1]
18 %malloccall3 = tail call i8* @malloc(i32 %mallocsize2) ; <i8*> [#uses=1]
19 %1 = bitcast i8* %malloccall3 to %struct.xyz* ; <%struct.xyz*> [#uses=1]
20 store %struct.xyz* %1, %struct.xyz** @Y, align 8
24 define %struct.xyz* @load_train() #0 {
25 ; CHECK-LABEL: load_train(
26 ; CHECK: load %struct.xyz*, %struct.xyz** @Y
28 %0 = load %struct.xyz*, %struct.xyz** @Y, align 8 ; <%struct.xyz*> [#uses=0]
32 declare noalias i8* @malloc(i32)
34 attributes #0 = { "null-pointer-is-valid"="true" }