xref: /aosp_15_r20/external/llvm/test/Transforms/GlobalOpt/SROA-section.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; Verify that section assignment is copied during SROA
2*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -globalopt -S | FileCheck %s
3*9880d681SAndroid Build Coastguard Worker; CHECK: @G.0
4*9880d681SAndroid Build Coastguard Worker; CHECK: section ".foo"
5*9880d681SAndroid Build Coastguard Worker; CHECK: @G.1
6*9880d681SAndroid Build Coastguard Worker; CHECK: section ".foo"
7*9880d681SAndroid Build Coastguard Worker; CHECK: @G.2
8*9880d681SAndroid Build Coastguard Worker; CHECK: section ".foo"
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Worker%T = type { double, double, double }
11*9880d681SAndroid Build Coastguard Worker@G = internal global %T zeroinitializer, align 16, section ".foo"
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Workerdefine void @test() {
14*9880d681SAndroid Build Coastguard Worker  store double 1.0, double* getelementptr (%T, %T* @G, i32 0, i32 0), align 16
15*9880d681SAndroid Build Coastguard Worker  store double 2.0, double* getelementptr (%T, %T* @G, i32 0, i32 1), align 8
16*9880d681SAndroid Build Coastguard Worker  store double 3.0, double* getelementptr (%T, %T* @G, i32 0, i32 2), align 16
17*9880d681SAndroid Build Coastguard Worker  ret void
18*9880d681SAndroid Build Coastguard Worker}
19*9880d681SAndroid Build Coastguard Worker
20*9880d681SAndroid Build Coastguard Workerdefine double @test2() {
21*9880d681SAndroid Build Coastguard Worker  %V1 = load double, double* getelementptr (%T, %T* @G, i32 0, i32 0), align 16
22*9880d681SAndroid Build Coastguard Worker  %V2 = load double, double* getelementptr (%T, %T* @G, i32 0, i32 1), align 8
23*9880d681SAndroid Build Coastguard Worker  %V3 = load double, double* getelementptr (%T, %T* @G, i32 0, i32 2), align 16
24*9880d681SAndroid Build Coastguard Worker  %R = fadd double %V1, %V2
25*9880d681SAndroid Build Coastguard Worker  %R2 = fadd double %R, %V3
26*9880d681SAndroid Build Coastguard Worker  ret double %R2
27*9880d681SAndroid Build Coastguard Worker}
28