summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2011-11-22 06:27:18 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2011-11-22 06:27:18 +0000
commit254a13282c97469973b4fa8cc0e110ed6160642c (patch)
tree34776d98c4d2a651d258c26554589144cb2521c1 /test
parentf7de577a08a705970f0fd8f3c1bb40f7040e4476 (diff)
downloadllvm-254a13282c97469973b4fa8cc0e110ed6160642c.tar.gz
llvm-254a13282c97469973b4fa8cc0e110ed6160642c.tar.bz2
llvm-254a13282c97469973b4fa8cc0e110ed6160642c.tar.xz
If a register is both an early clobber and part of a tied use, handle the use
before the clobber so that we copy the value if needed. Fixes pr11415. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145056 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/X86/pr11415.ll23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/CodeGen/X86/pr11415.ll b/test/CodeGen/X86/pr11415.ll
new file mode 100644
index 0000000000..92c530bb9e
--- /dev/null
+++ b/test/CodeGen/X86/pr11415.ll
@@ -0,0 +1,23 @@
+; RUN: llc %s -o - -regalloc=fast | FileCheck %s
+
+; We used to consider the early clobber in the second asm statement as
+; defining %0 before it was read. This caused us to omit the
+; movq -8(%rsp), %rdx
+
+; CHECK: #APP
+; CHECK-NEXT: #NO_APP
+; CHECK-NEXT: movq %rcx, %rax
+; CHECK-NEXT: movq %rax, -8(%rsp)
+; CHECK-NEXT: movq -8(%rsp), %rdx
+; CHECK-NEXT: #APP
+; CHECK-NEXT: #NO_APP
+; CHECK-NEXT: movq %rdx, %rax
+; CHECK-NEXT: movq %rdx, -8(%rsp)
+; CHECK-NEXT: ret
+
+define i64 @foo() {
+entry:
+ %0 = tail call i64 asm "", "={cx}"() nounwind
+ %1 = tail call i64 asm "", "=&r,0,r,~{rax}"(i64 %0, i64 %0) nounwind
+ ret i64 %1
+}