summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/Thumb2
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2015-04-23 20:31:35 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2015-04-23 20:31:35 +0000
commit167668f8c82fb49949a058c867ddabb0c1ec48fe (patch)
tree3b5fd5f9a958982f3ab2e70ba2f218e04bf5a556 /llvm/test/CodeGen/Thumb2
parentcfee5b04bc510e90659eeb20127f9cda0b57f71f (diff)
downloadbcm5719-llvm-167668f8c82fb49949a058c867ddabb0c1ec48fe.tar.gz
bcm5719-llvm-167668f8c82fb49949a058c867ddabb0c1ec48fe.zip
Thumb2: When applying branch optimizations, visit branches in reverse order.
The order in which branches appear in ImmBranches is approximately their order within the function body. By visiting later branches first, we reduce the distance between earlier forward branches and their targets, making it more likely that the cbn?z optimization, which can only apply to forward branches, will succeed for those earlier branches. Differential Revision: http://reviews.llvm.org/D9185 llvm-svn: 235640
Diffstat (limited to 'llvm/test/CodeGen/Thumb2')
-rw-r--r--llvm/test/CodeGen/Thumb2/cbnz.ll54
1 files changed, 54 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/Thumb2/cbnz.ll b/llvm/test/CodeGen/Thumb2/cbnz.ll
new file mode 100644
index 00000000000..5c0bb5bfe1c
--- /dev/null
+++ b/llvm/test/CodeGen/Thumb2/cbnz.ll
@@ -0,0 +1,54 @@
+; RUN: llc -mtriple thumbv7-unknown-linux -o - %s | FileCheck %s
+
+declare void @x()
+declare void @y()
+
+define void @f(i32 %x, i32 %y) {
+ ; CHECK-LABEL: f:
+ ; CHECK: cbnz
+ %p = icmp eq i32 %x, 0
+ br i1 %p, label %t, label %f
+
+t:
+ call void @x()
+ call void @x()
+ call void @x()
+ call void @x()
+ call void @x()
+ call void @x()
+ call void @x()
+ call void @x()
+ call void @x()
+ call void @x()
+ call void @x()
+ call void @x()
+ call void @x()
+ call void @x()
+ call void @x()
+ call void @x()
+ ; CHECK: cbnz
+ %q = icmp eq i32 %y, 0
+ br i1 %q, label %t2, label %f
+
+t2:
+ call void @x()
+ call void @x()
+ call void @x()
+ call void @x()
+ call void @x()
+ call void @x()
+ call void @x()
+ call void @x()
+ call void @x()
+ call void @x()
+ call void @x()
+ call void @x()
+ call void @x()
+ call void @x()
+ call void @x()
+ br label %f
+
+f:
+ call void @y()
+ ret void
+}
OpenPOWER on IntegriCloud