summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/SimplifyCFG/preserve-branchweights.ll
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2011-12-26 20:54:14 +0000
committerNick Lewycky <nicholas@mxc.ca>2011-12-26 20:54:14 +0000
commit8d302df4a43e95c89de272adff79c71c61249990 (patch)
tree4aa77c903124d350e4a1b7ae16c818314e350ad9 /llvm/test/Transforms/SimplifyCFG/preserve-branchweights.ll
parente87d54c817d1c71e82d92632cdc9948f4c460e03 (diff)
downloadbcm5719-llvm-8d302df4a43e95c89de272adff79c71c61249990.tar.gz
bcm5719-llvm-8d302df4a43e95c89de272adff79c71c61249990.zip
Update the branch weight metadata when reversing the order of a branch.
llvm-svn: 147280
Diffstat (limited to 'llvm/test/Transforms/SimplifyCFG/preserve-branchweights.ll')
-rw-r--r--llvm/test/Transforms/SimplifyCFG/preserve-branchweights.ll26
1 files changed, 26 insertions, 0 deletions
diff --git a/llvm/test/Transforms/SimplifyCFG/preserve-branchweights.ll b/llvm/test/Transforms/SimplifyCFG/preserve-branchweights.ll
new file mode 100644
index 00000000000..dab0d7cdf99
--- /dev/null
+++ b/llvm/test/Transforms/SimplifyCFG/preserve-branchweights.ll
@@ -0,0 +1,26 @@
+; RUN: opt -simplifycfg -S -o - < %s | FileCheck %s
+
+declare void @helper(i32)
+
+define void @test1(i1 %a, i1 %b) {
+; CHECK @test1
+entry:
+ br i1 %a, label %Y, label %X, !prof !0
+; CHECK: br i1 %or.cond, label %Z, label %Y, !prof !0
+
+X:
+ %c = or i1 %b, false
+ br i1 %c, label %Z, label %Y
+
+Y:
+ call void @helper(i32 0)
+ ret void
+
+Z:
+ call void @helper(i32 1)
+ ret void
+}
+
+!0 = metadata !{metadata !"branch_weights", i32 1, i32 2}
+
+; CHECK: !0 = metadata !{metadata !"branch_weights", i32 2, i32 1}
OpenPOWER on IntegriCloud