summaryrefslogtreecommitdiff
path: root/test/CodeGen/ARM64
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2014-04-03 20:51:08 +0000
committerLang Hames <lhames@gmail.com>2014-04-03 20:51:08 +0000
commit89218827c87ce2e3ef9f968550e060fae9dfd827 (patch)
tree8d2deb1e7df579e4b8adeef7164fc3a320eb1e33 /test/CodeGen/ARM64
parent23839869646bc14cd487801fd753451370f2ad25 (diff)
downloadllvm-89218827c87ce2e3ef9f968550e060fae9dfd827.tar.gz
llvm-89218827c87ce2e3ef9f968550e060fae9dfd827.tar.bz2
llvm-89218827c87ce2e3ef9f968550e060fae9dfd827.tar.xz
[ARM64] Teach the ARM64DeadRegisterDefinition pass to respect implicit-defs.
When rematerializing through truncates, the coalescer may produce instructions with dead defs, but live implicit-defs of subregs: E.g. %X1<def,dead> = MOVi64imm 2, %W1<imp-def>; %X1:GPR64, %W1:GPR32 These instructions are live, and their definitions should not be rewritten. Fixes <rdar://problem/16492408> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205565 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/ARM64')
-rw-r--r--test/CodeGen/ARM64/dead-register-def-bug.ll32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/CodeGen/ARM64/dead-register-def-bug.ll b/test/CodeGen/ARM64/dead-register-def-bug.ll
new file mode 100644
index 0000000000..1bbcf50ba7
--- /dev/null
+++ b/test/CodeGen/ARM64/dead-register-def-bug.ll
@@ -0,0 +1,32 @@
+; RUN: llc -mtriple="arm64-apple-ios" < %s | FileCheck %s
+;
+; Check that the dead register definition pass is considering implicit defs.
+; When rematerializing through truncates, the coalescer may produce instructions
+; with dead defs, but live implicit-defs of subregs:
+; E.g. %X1<def, dead> = MOVi64imm 2, %W1<imp-def>; %X1:GPR64, %W1:GPR32
+; These instructions are live, and their definitions should not be rewritten.
+;
+; <rdar://problem/16492408>
+
+define void @testcase() {
+; CHECK: testcase:
+; CHECK-NOT: orr xzr, xzr, #0x2
+
+bb1:
+ %tmp1 = tail call float @ceilf(float 2.000000e+00)
+ %tmp2 = fptoui float %tmp1 to i64
+ br i1 undef, label %bb2, label %bb3
+
+bb2:
+ tail call void @foo()
+ br label %bb3
+
+bb3:
+ %tmp3 = trunc i64 %tmp2 to i32
+ tail call void @bar(i32 %tmp3)
+ ret void
+}
+
+declare void @foo()
+declare void @bar(i32)
+declare float @ceilf(float) nounwind readnone