xref: /aosp_15_r20/external/llvm/test/Transforms/GlobalOpt/MallocSROA-section.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: opt -globalopt -S < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; CHECK: @Y.f0
3*9880d681SAndroid Build Coastguard Worker; CHECK: section ".foo"
4*9880d681SAndroid Build Coastguard Worker; CHECK: @Y.f1
5*9880d681SAndroid Build Coastguard Worker; CHECK: section ".foo"
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Worker%struct.xyz = type { double, i32 }
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Worker@Y = internal global %struct.xyz* null ,section ".foo"            ; <%struct.xyz**> [#uses=2]
10*9880d681SAndroid Build Coastguard Worker@numf2s = external global i32                     ; <i32*> [#uses=1]
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard Workerdefine void @init_net()  {
13*9880d681SAndroid Build Coastguard Workerentry:
14*9880d681SAndroid Build Coastguard Worker  %0 = load i32, i32* @numf2s, align 4                 ; <i32> [#uses=1]
15*9880d681SAndroid Build Coastguard Worker  %mallocsize2 = shl i32 %0, 4                    ; <i32> [#uses=1]
16*9880d681SAndroid Build Coastguard Worker  %malloccall3 = tail call i8* @malloc(i32 %mallocsize2)  ; <i8*> [#uses=1]
17*9880d681SAndroid Build Coastguard Worker  %1 = bitcast i8* %malloccall3 to %struct.xyz*   ; <%struct.xyz*> [#uses=1]
18*9880d681SAndroid Build Coastguard Worker  store %struct.xyz* %1, %struct.xyz** @Y, align 8
19*9880d681SAndroid Build Coastguard Worker  ret void
20*9880d681SAndroid Build Coastguard Worker}
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Workerdefine void @load_train()  {
23*9880d681SAndroid Build Coastguard Workerentry:
24*9880d681SAndroid Build Coastguard Worker  %0 = load %struct.xyz*, %struct.xyz** @Y, align 8             ; <%struct.xyz*> [#uses=0]
25*9880d681SAndroid Build Coastguard Worker  ret void
26*9880d681SAndroid Build Coastguard Worker}
27*9880d681SAndroid Build Coastguard Worker
28*9880d681SAndroid Build Coastguard Workerdeclare noalias i8* @malloc(i32)
29