xref: /llvm-project/llvm/test/Transforms/GlobalOpt/MallocSROA-section.ll (revision d586bd5ca231a6022f439d4c6e43cfeeb53eb1d6)
1; RUN: opt -passes=globalopt -S < %s | FileCheck %s
2; CHECK: @Y = {{.*}} section ".foo"
3
4%struct.xyz = type { double, i32 }
5
6@Y = internal global ptr null ,section ".foo"            ; <ptr> [#uses=2]
7@numf2s = external global i32                     ; <ptr> [#uses=1]
8
9define void @init_net()  {
10entry:
11  %0 = load i32, ptr @numf2s, align 4                 ; <i32> [#uses=1]
12  %mallocsize2 = shl i32 %0, 4                    ; <i32> [#uses=1]
13  %malloccall3 = tail call ptr @malloc(i32 %mallocsize2)  ; <ptr> [#uses=1]
14  store ptr %malloccall3, ptr @Y, align 8
15  ret void
16}
17
18define void @load_train()  {
19entry:
20  %0 = load ptr, ptr @Y, align 8             ; <ptr> [#uses=0]
21  ret void
22}
23
24declare noalias ptr @malloc(i32)
25