xref: /aosp_15_r20/external/llvm/test/CodeGen/Thumb2/2013-02-19-tail-call-register-hint.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=thumbv7s-apple-ios6.0.0 -verify-machineinstrs
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; Check to make sure the tail-call return at the end doesn't use a
4*9880d681SAndroid Build Coastguard Worker; callee-saved register. Register hinting from t2LDRDri was getting this
5*9880d681SAndroid Build Coastguard Worker; wrong. The intervening call will force allocation to try a high register
6*9880d681SAndroid Build Coastguard Worker; first, so the hint will attempt to fire, but must be rejected due to
7*9880d681SAndroid Build Coastguard Worker; not being in the allocation order for the tcGPR register class.
8*9880d681SAndroid Build Coastguard Worker; The machine instruction verifier will make sure that all actually worked
9*9880d681SAndroid Build Coastguard Worker; out the way it's supposed to.
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Worker%"myclass" = type { %struct.foo }
12*9880d681SAndroid Build Coastguard Worker%struct.foo = type { i32, [40 x i8] }
13*9880d681SAndroid Build Coastguard Worker
14*9880d681SAndroid Build Coastguard Workerdefine hidden void @func(i8* %Data) nounwind ssp {
15*9880d681SAndroid Build Coastguard Worker  %1 = getelementptr inbounds i8, i8* %Data, i32 12
16*9880d681SAndroid Build Coastguard Worker  %2 = bitcast i8* %1 to %"myclass"*
17*9880d681SAndroid Build Coastguard Worker  tail call void @abc(%"myclass"* %2) nounwind
18*9880d681SAndroid Build Coastguard Worker  tail call void @def(%"myclass"* %2) nounwind
19*9880d681SAndroid Build Coastguard Worker  %3 = getelementptr inbounds i8, i8* %Data, i32 8
20*9880d681SAndroid Build Coastguard Worker  %4 = bitcast i8* %3 to i8**
21*9880d681SAndroid Build Coastguard Worker  %5 = load i8*, i8** %4, align 4
22*9880d681SAndroid Build Coastguard Worker  tail call void @ghi(i8* %5) nounwind
23*9880d681SAndroid Build Coastguard Worker  %6 = bitcast i8* %Data to void (i8*)**
24*9880d681SAndroid Build Coastguard Worker  %7 = load void (i8*)*, void (i8*)** %6, align 4
25*9880d681SAndroid Build Coastguard Worker  %8 = getelementptr inbounds i8, i8* %Data, i32 4
26*9880d681SAndroid Build Coastguard Worker  %9 = bitcast i8* %8 to i8**
27*9880d681SAndroid Build Coastguard Worker  %10 = load i8*, i8** %9, align 4
28*9880d681SAndroid Build Coastguard Worker  %11 = icmp eq i8* %Data, null
29*9880d681SAndroid Build Coastguard Worker  br i1 %11, label %14, label %12
30*9880d681SAndroid Build Coastguard Worker
31*9880d681SAndroid Build Coastguard Worker; <label>:12                                      ; preds = %0
32*9880d681SAndroid Build Coastguard Worker  %13 = tail call %"myclass"* @jkl(%"myclass"* %2) nounwind
33*9880d681SAndroid Build Coastguard Worker  tail call void @mno(i8* %Data) nounwind
34*9880d681SAndroid Build Coastguard Worker  br label %14
35*9880d681SAndroid Build Coastguard Worker
36*9880d681SAndroid Build Coastguard Worker; <label>:14                                      ; preds = %12, %0
37*9880d681SAndroid Build Coastguard Worker  tail call void %7(i8* %10) nounwind
38*9880d681SAndroid Build Coastguard Worker  ret void
39*9880d681SAndroid Build Coastguard Worker}
40*9880d681SAndroid Build Coastguard Worker
41*9880d681SAndroid Build Coastguard Workerdeclare void @mno(i8*)
42*9880d681SAndroid Build Coastguard Worker
43*9880d681SAndroid Build Coastguard Workerdeclare void @def(%"myclass"*)
44*9880d681SAndroid Build Coastguard Worker
45*9880d681SAndroid Build Coastguard Workerdeclare void @abc(%"myclass"*)
46*9880d681SAndroid Build Coastguard Worker
47*9880d681SAndroid Build Coastguard Workerdeclare void @ghi(i8*)
48*9880d681SAndroid Build Coastguard Worker
49*9880d681SAndroid Build Coastguard Workerdeclare %"myclass"* @jkl(%"myclass"*) nounwind
50