34 lines · plain
1; RUN: opt -passes=globalopt -S < %s | FileCheck %s2; CHECK: @Y3; CHECK: section ".foo"4 5%struct.xyz = type { double, i32 }6 7@Y = internal global ptr null ,section ".foo" ; <ptr> [#uses=2]8@numf2s = external global i32 ; <ptr> [#uses=1]9 10define void @init_net() #0 {11; CHECK-LABEL: init_net(12; CHECK: load i32, ptr @numf2s13; CHECK: call ptr @malloc14; CHECK: store ptr {{.*}}, ptr @Y15entry:16 %0 = load i32, ptr @numf2s, align 4 ; <i32> [#uses=1]17 %mallocsize2 = shl i32 %0, 4 ; <i32> [#uses=1]18 %malloccall3 = tail call ptr @malloc(i32 %mallocsize2) ; <ptr> [#uses=1]19 store ptr %malloccall3, ptr @Y, align 820 ret void21}22 23define ptr @load_train() #0 {24; CHECK-LABEL: load_train(25; CHECK: load ptr, ptr @Y26entry:27 %0 = load ptr, ptr @Y, align 8 ; <ptr> [#uses=0]28 ret ptr %029}30 31declare noalias ptr @malloc(i32)32 33attributes #0 = { null_pointer_is_valid }34