summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/X86
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-08-21 02:32:36 +0000
committerDan Gohman <gohman@apple.com>2010-08-21 02:32:36 +0000
commit42ef669d815fd9745cbd0c06e573052647cd16b3 (patch)
treecb499e0c14e54ca786ffb972a87d8baae1be6ed4 /llvm/test/CodeGen/X86
parentab4dbea096e12cd0aff9fba36d431d13e8d75557 (diff)
downloadbcm5719-llvm-42ef669d815fd9745cbd0c06e573052647cd16b3.tar.gz
bcm5719-llvm-42ef669d815fd9745cbd0c06e573052647cd16b3.zip
Fix x86 fast-isel's cmp+branch folding to avoid folding when the
comparison is in a different basic block from the branch. In such cases, the comparison's operands may not have initialized virtual registers available. llvm-svn: 111709
Diffstat (limited to 'llvm/test/CodeGen/X86')
-rw-r--r--llvm/test/CodeGen/X86/fast-isel-cmp-branch.ll29
1 files changed, 29 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/fast-isel-cmp-branch.ll b/llvm/test/CodeGen/X86/fast-isel-cmp-branch.ll
new file mode 100644
index 00000000000..4ab1bc61c7e
--- /dev/null
+++ b/llvm/test/CodeGen/X86/fast-isel-cmp-branch.ll
@@ -0,0 +1,29 @@
+; RUN: llc -O0 -march=x86-64 -asm-verbose=false < %s | FileCheck %s
+; rdar://8337108
+
+; Fast-isel shouldn't try to look through the compare because it's in a
+; different basic block, so its operands aren't necessarily exported
+; for cross-block usage.
+
+; CHECK: movb %al, 7(%rsp)
+; CHECK: callq {{_?}}bar
+; CHECK: movb 7(%rsp), %al
+
+declare void @bar()
+
+define void @foo(i32 %a, i32 %b) nounwind {
+entry:
+ %q = add i32 %a, 7
+ %r = add i32 %b, 9
+ %t = icmp ult i32 %q, %r
+ invoke void @bar() to label %next unwind label %unw
+next:
+ br i1 %t, label %true, label %return
+true:
+ call void @bar()
+ br label %return
+return:
+ ret void
+unw:
+ unreachable
+}
OpenPOWER on IntegriCloud