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