diff options
author | Manman Ren <mren@apple.com> | 2012-09-12 17:04:11 +0000 |
---|---|---|
committer | Manman Ren <mren@apple.com> | 2012-09-12 17:04:11 +0000 |
commit | ee99c7f1bfe115f8fe2d1b118010a82c1ce83f18 (patch) | |
tree | 36355f606540276593225eaf8074e1ed74e4c774 /test | |
parent | 67c8978617c3bce9d07210f93f6c64c715f77695 (diff) |
PGO: preserve branch-weight metadata when removing a case which jumps
to the default target.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163724 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Transforms/SimplifyCFG/preserve-branchweights.ll | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/test/Transforms/SimplifyCFG/preserve-branchweights.ll b/test/Transforms/SimplifyCFG/preserve-branchweights.ll index c7917857ee..71b27809ff 100644 --- a/test/Transforms/SimplifyCFG/preserve-branchweights.ll +++ b/test/Transforms/SimplifyCFG/preserve-branchweights.ll @@ -79,10 +79,42 @@ Z: ret void } +;; test5 - The case where it jumps to the default target will be removed. +define void @test5(i32 %M, i32 %N) nounwind uwtable { +entry: + switch i32 %N, label %sw2 [ + i32 1, label %sw2 + i32 2, label %sw.bb + i32 3, label %sw.bb1 + ], !prof !3 +; CHECK: test5 +; CHECK: switch i32 %N, label %sw2 [ +; CHECK: i32 3, label %sw.bb1 +; CHECK: i32 2, label %sw.bb +; CHECK: ], !prof !2 + +sw.bb: + call void @helper(i32 0) + br label %sw.epilog + +sw.bb1: + call void @helper(i32 1) + br label %sw.epilog + +sw2: + call void @helper(i32 2) + br label %sw.epilog + +sw.epilog: + ret void +} + !0 = metadata !{metadata !"branch_weights", i32 3, i32 5} !1 = metadata !{metadata !"branch_weights", i32 1, i32 1} !2 = metadata !{metadata !"branch_weights", i32 1, i32 2} +!3 = metadata !{metadata !"branch_weights", i32 4, i32 3, i32 2, i32 1} ; CHECK: !0 = metadata !{metadata !"branch_weights", i32 5, i32 11} ; CHECK: !1 = metadata !{metadata !"branch_weights", i32 1, i32 5} -; CHECK-NOT: !2 +; CHECK: !2 = metadata !{metadata !"branch_weights", i32 7, i32 1, i32 2} +; CHECK-NOT: !3 |