xref: /aosp_15_r20/external/llvm/test/CodeGen/AArch64/arm64-fast-isel-alloca.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; This test should cause the TargetMaterializeAlloca to be invoked
2*9880d681SAndroid Build Coastguard Worker; RUN: llc -O0 -fast-isel-abort=1 -verify-machineinstrs -mtriple=arm64-apple-darwin -disable-fp-elim < %s | FileCheck %s
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker%struct.S1Ty = type { i64 }
5*9880d681SAndroid Build Coastguard Worker%struct.S2Ty = type { %struct.S1Ty, %struct.S1Ty }
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Workerdefine void @takeS1(%struct.S1Ty* %V) nounwind {
8*9880d681SAndroid Build Coastguard Workerentry:
9*9880d681SAndroid Build Coastguard Worker  %V.addr = alloca %struct.S1Ty*, align 8
10*9880d681SAndroid Build Coastguard Worker  store %struct.S1Ty* %V, %struct.S1Ty** %V.addr, align 8
11*9880d681SAndroid Build Coastguard Worker  ret void
12*9880d681SAndroid Build Coastguard Worker}
13*9880d681SAndroid Build Coastguard Worker
14*9880d681SAndroid Build Coastguard Workerdefine void @main() nounwind {
15*9880d681SAndroid Build Coastguard Workerentry:
16*9880d681SAndroid Build Coastguard Worker; CHECK: main
17*9880d681SAndroid Build Coastguard Worker; CHECK: add x29, sp, #16
18*9880d681SAndroid Build Coastguard Worker; CHECK: mov [[REG:x[0-9]+]], sp
19*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: add x0, [[REG]], #8
20*9880d681SAndroid Build Coastguard Worker  %E = alloca %struct.S2Ty, align 4
21*9880d681SAndroid Build Coastguard Worker  %B = getelementptr inbounds %struct.S2Ty, %struct.S2Ty* %E, i32 0, i32 1
22*9880d681SAndroid Build Coastguard Worker  call void @takeS1(%struct.S1Ty* %B)
23*9880d681SAndroid Build Coastguard Worker  ret void
24*9880d681SAndroid Build Coastguard Worker}
25