summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorMatthew Simpson <mssimpso@codeaurora.org>2017-06-27 15:00:22 +0000
committerMatthew Simpson <mssimpso@codeaurora.org>2017-06-27 15:00:22 +0000
commit0bd79f416a2416a88803cceb1a59c218bb7639d1 (patch)
tree27d370d3b469bcb446311d3afbd5f0aa84a7edb2 /llvm/test
parent2189fe187042dc1818b4436b5dea5c9c520c2cc8 (diff)
downloadbcm5719-llvm-0bd79f416a2416a88803cceb1a59c218bb7639d1.tar.gz
bcm5719-llvm-0bd79f416a2416a88803cceb1a59c218bb7639d1.zip
[AArch64] Update successor probabilities after ccmp-conversion
This patch modifies the conditional compares pass so that it keeps successor probabilities up-to-date after the conversion. Previously, successor probabilities were being normalized to a uniform distribution, even though they may have been heavily biased prior to the conversion (e.g., if one of the edges was the back edge of a loop). This loss of information affected passes later in the pipeline. Differential Revision: https://reviews.llvm.org/D34109 llvm-svn: 306412
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/CodeGen/AArch64/arm64-ccmp.ll6
-rw-r--r--llvm/test/CodeGen/AArch64/ccmp-successor-probs.mir46
2 files changed, 49 insertions, 3 deletions
diff --git a/llvm/test/CodeGen/AArch64/arm64-ccmp.ll b/llvm/test/CodeGen/AArch64/arm64-ccmp.ll
index 2682fa7dcce..a910585e7f5 100644
--- a/llvm/test/CodeGen/AArch64/arm64-ccmp.ll
+++ b/llvm/test/CodeGen/AArch64/arm64-ccmp.ll
@@ -108,9 +108,9 @@ if.end: ; preds = %if.then, %lor.lhs.f
; CHECK: cmp w0, #1
; CHECK: sdiv [[DIVRES:w[0-9]+]], w1, w0
; CHECK: ccmp [[DIVRES]], #16, #0, ge
-; CHECK: b.gt [[BLOCK:LBB[0-9_]+]]
-; CHECK: bl _foo
+; CHECK: b.le [[BLOCK:LBB[0-9_]+]]
; CHECK: [[BLOCK]]:
+; CHECK: bl _foo
; CHECK: orr w0, wzr, #0x7
define i32 @speculate_division(i32 %a, i32 %b) nounwind ssp {
entry:
@@ -135,7 +135,7 @@ if.end:
; CHECK: cmp
; CHECK-NOT: b.
; CHECK: fccmp {{.*}}, #8, ge
-; CHECK: b.lt
+; CHECK: b.ge
define i32 @single_fcmp(i32 %a, float %b) nounwind ssp {
entry:
%cmp = icmp sgt i32 %a, 0
diff --git a/llvm/test/CodeGen/AArch64/ccmp-successor-probs.mir b/llvm/test/CodeGen/AArch64/ccmp-successor-probs.mir
new file mode 100644
index 00000000000..8e81c419841
--- /dev/null
+++ b/llvm/test/CodeGen/AArch64/ccmp-successor-probs.mir
@@ -0,0 +1,46 @@
+# RUN: llc -o - %s -mtriple=aarch64--linux-gnu -mcpu=falkor -run-pass=aarch64-ccmp | FileCheck %s
+---
+# This test checks that successor probabilties are properly updated after a
+# ccmp-conversion.
+#
+# CHECK-LABEL: name: aarch64-ccmp-successor-probs
+# CHECK: bb.0:
+# CHECK-NEXT: successors: %bb.2(0x04000000), %bb.3(0x7c000000)
+# CHECK: CCMPXr %5, %4, 0, 10, implicit-def %nzcv, implicit %nzcv
+#
+name: aarch64-ccmp-successor-probs
+registers:
+ - { id: 0, class: gpr64 }
+ - { id: 1, class: gpr64 }
+ - { id: 2, class: gpr64 }
+ - { id: 3, class: gpr64 }
+ - { id: 4, class: gpr64 }
+ - { id: 5, class: gpr64 }
+ - { id: 6, class: gpr64 }
+ - { id: 7, class: gpr64 }
+body : |
+ bb.0:
+ successors: %bb.1(0x7e000000), %bb.2(0x02000000)
+
+ %0 = LDRXui killed %x0, 69
+ %1 = COPY %xzr
+ %2 = SUBSXrr %1, %0, implicit-def dead %nzcv
+ %3 = SUBSXri %x1, 1, 0, implicit-def dead %nzcv
+ %4 = COPY %0
+ %5 = COPY %3
+ %6 = SUBSXrr %x1, killed %2, implicit-def %nzcv
+ Bcc 11, %bb.2, implicit %nzcv
+ B %bb.1
+
+ bb.1:
+ successors: %bb.2(0x02082082), %bb.3(0x7df7df7e)
+
+ %7 = SUBSXrr %5, %4, implicit-def %nzcv
+ Bcc 12, %bb.2, implicit %nzcv
+ B %bb.3
+
+ bb.2:
+ successors: %bb.3(0x80000000)
+
+ bb.3:
+...
OpenPOWER on IntegriCloud