summaryrefslogtreecommitdiffstats
path: root/llvm/test/Analysis/BranchProbabilityInfo/basic.ll
diff options
context:
space:
mode:
authorSerguei Katkov <serguei.katkov@azul.com>2017-04-12 05:42:14 +0000
committerSerguei Katkov <serguei.katkov@azul.com>2017-04-12 05:42:14 +0000
commitecebc3db72d8f4f03cb6ce3c122f36b4cda3cec5 (patch)
tree23820d296349324eb8bc4930ca42869bd4a165b3 /llvm/test/Analysis/BranchProbabilityInfo/basic.ll
parent75ed0acf97f9af3d9e0ba781d9ff1de7b914f261 (diff)
downloadbcm5719-llvm-ecebc3db72d8f4f03cb6ce3c122f36b4cda3cec5.tar.gz
bcm5719-llvm-ecebc3db72d8f4f03cb6ce3c122f36b4cda3cec5.zip
[BPI] Refactor post domination calculation and simple fix for ColdCall
Collection of PostDominatedByUnreachable and PostDominatedByColdCall have been split out of heuristics itself. Update of the data happens now for each basic block (before update for PostDominatedByColdCall might be skipped if unreachable or matadata heuristic handled this basic block). This separation allows re-ordering of heuristics without loosing the post-domination information. Reviewers: sanjoy, junbuml, vsk, chandlerc, reames Reviewed By: chandlerc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D31701 llvm-svn: 300029
Diffstat (limited to 'llvm/test/Analysis/BranchProbabilityInfo/basic.ll')
-rw-r--r--llvm/test/Analysis/BranchProbabilityInfo/basic.ll37
1 files changed, 37 insertions, 0 deletions
diff --git a/llvm/test/Analysis/BranchProbabilityInfo/basic.ll b/llvm/test/Analysis/BranchProbabilityInfo/basic.ll
index 67d3e9e850c..94ea5a3d1d8 100644
--- a/llvm/test/Analysis/BranchProbabilityInfo/basic.ll
+++ b/llvm/test/Analysis/BranchProbabilityInfo/basic.ll
@@ -143,6 +143,43 @@ exit:
declare i32 @regular_function(i32 %i)
+define i32 @test_cold_call_sites_with_prof(i32 %a, i32 %b, i1 %flag, i1 %flag2) {
+; CHECK: Printing analysis {{.*}} for function 'test_cold_call_sites_with_prof'
+entry:
+ br i1 %flag, label %then, label %else
+; CHECK: edge entry -> then probability is 0x07878788 / 0x80000000 = 5.88%
+; CHECK: edge entry -> else probability is 0x78787878 / 0x80000000 = 94.12% [HOT edge]
+
+then:
+ br i1 %flag2, label %then2, label %else2, !prof !3
+; CHECK: edge then -> then2 probability is 0x7ebb907a / 0x80000000 = 99.01% [HOT edge]
+; CHECK: edge then -> else2 probability is 0x01446f86 / 0x80000000 = 0.99%
+
+then2:
+ br label %join
+; CHECK: edge then2 -> join probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge]
+
+else2:
+ br label %join
+; CHECK: edge else2 -> join probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge]
+
+join:
+ %joinresult = phi i32 [ %a, %then2 ], [ %b, %else2 ]
+ call void @coldfunc()
+ br label %exit
+; CHECK: edge join -> exit probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge]
+
+else:
+ br label %exit
+; CHECK: edge else -> exit probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge]
+
+exit:
+ %result = phi i32 [ %joinresult, %join ], [ %b, %else ]
+ ret i32 %result
+}
+
+!3 = !{!"branch_weights", i32 100, i32 1}
+
define i32 @test_cold_call_sites(i32* %a) {
; Test that edges to blocks post-dominated by cold call sites
; are marked as not expected to be taken.
OpenPOWER on IntegriCloud