xref: /aosp_15_r20/external/llvm/test/CodeGen/AArch64/arm64-dead-register-def-bug.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple="arm64-apple-ios" < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker;
3*9880d681SAndroid Build Coastguard Worker; Check that the dead register definition pass is considering implicit defs.
4*9880d681SAndroid Build Coastguard Worker; When rematerializing through truncates, the coalescer may produce instructions
5*9880d681SAndroid Build Coastguard Worker; with dead defs, but live implicit-defs of subregs:
6*9880d681SAndroid Build Coastguard Worker; E.g. %X1<def, dead> = MOVi64imm 2, %W1<imp-def>; %X1:GPR64, %W1:GPR32
7*9880d681SAndroid Build Coastguard Worker; These instructions are live, and their definitions should not be rewritten.
8*9880d681SAndroid Build Coastguard Worker;
9*9880d681SAndroid Build Coastguard Worker; <rdar://problem/16492408>
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Workerdefine void @testcase() {
12*9880d681SAndroid Build Coastguard Worker; CHECK: testcase:
13*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: orr xzr, xzr, #0x2
14*9880d681SAndroid Build Coastguard Worker
15*9880d681SAndroid Build Coastguard Workerbb1:
16*9880d681SAndroid Build Coastguard Worker  %tmp1 = tail call float @ceilf(float 2.000000e+00)
17*9880d681SAndroid Build Coastguard Worker  %tmp2 = fptoui float %tmp1 to i64
18*9880d681SAndroid Build Coastguard Worker  br i1 undef, label %bb2, label %bb3
19*9880d681SAndroid Build Coastguard Worker
20*9880d681SAndroid Build Coastguard Workerbb2:
21*9880d681SAndroid Build Coastguard Worker  tail call void @foo()
22*9880d681SAndroid Build Coastguard Worker  br label %bb3
23*9880d681SAndroid Build Coastguard Worker
24*9880d681SAndroid Build Coastguard Workerbb3:
25*9880d681SAndroid Build Coastguard Worker  %tmp3 = trunc i64 %tmp2 to i32
26*9880d681SAndroid Build Coastguard Worker  tail call void @bar(i32 %tmp3)
27*9880d681SAndroid Build Coastguard Worker  ret void
28*9880d681SAndroid Build Coastguard Worker}
29*9880d681SAndroid Build Coastguard Worker
30*9880d681SAndroid Build Coastguard Workerdeclare void @foo()
31*9880d681SAndroid Build Coastguard Workerdeclare void @bar(i32)
32*9880d681SAndroid Build Coastguard Workerdeclare float @ceilf(float) nounwind readnone
33