summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJuergen Ributzka <juergen@apple.com>2014-06-13 00:45:11 +0000
committerJuergen Ributzka <juergen@apple.com>2014-06-13 00:45:11 +0000
commit7f8d138f50f57144650dfba78ea0e6e168a23c54 (patch)
tree5ef27c18e67d5dbb6b529d6a195d0751c8445b63 /test
parentf7a2d5e387de25af9711f04f253bc0e63fd988dd (diff)
downloadllvm-7f8d138f50f57144650dfba78ea0e6e168a23c54.tar.gz
llvm-7f8d138f50f57144650dfba78ea0e6e168a23c54.tar.bz2
llvm-7f8d138f50f57144650dfba78ea0e6e168a23c54.tar.xz
[FastISel][X86] - Add branch weights
Add branch weights to branch instructions, so that the following passes can optimize based on it (i.e. basic block ordering). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210863 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/X86/fast-isel-branch_weights.ll19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/CodeGen/X86/fast-isel-branch_weights.ll b/test/CodeGen/X86/fast-isel-branch_weights.ll
new file mode 100644
index 0000000000..bc41395e1e
--- /dev/null
+++ b/test/CodeGen/X86/fast-isel-branch_weights.ll
@@ -0,0 +1,19 @@
+; RUN: llc < %s -mtriple=x86_64-apple-darwin10 | FileCheck %s
+; RUN: llc < %s -fast-isel -fast-isel-abort -mtriple=x86_64-apple-darwin10 | FileCheck %s
+
+; Test if the BBs are reordred according to their branch weights.
+define i64 @branch_weights_test(i64 %a, i64 %b) {
+; CHECK-LABEL: branch_weights_test
+; CHECK-LABEL: success
+; CHECK-LABEL: fail
+ %1 = icmp ult i64 %a, %b
+ br i1 %1, label %fail, label %success, !prof !0
+
+fail:
+ ret i64 -1
+
+success:
+ ret i64 0
+}
+
+!0 = metadata !{metadata !"branch_weights", i32 0, i32 2147483647}