add minimal test to show dropped metadata

llvm-svn: 268141
This commit is contained in:
Sanjay Patel 2016-04-30 00:12:54 +00:00
parent 5b407543c0
commit bc6fad0bdf
1 changed files with 28 additions and 0 deletions

View File

@ -1,3 +1,4 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -simplifycfg -S -o - < %s | FileCheck %s
declare void @helper(i32)
@ -411,6 +412,32 @@ return:
ret i32 %retval.0
}
; The 1st select should have branch weights equal to the 1st branch.
; The 2nd select should have freshly calculated branch weights.
define i32 @SimplifyCondBranchToCondBranch(i1 %cmpa, i1 %cmpb) {
; CHECK-LABEL: @SimplifyCondBranchToCondBranch(
; CHECK-NEXT: block1:
; CHECK-NEXT: [[BRMERGE:%.*]] = or i1 %cmpb, %cmpa
; CHECK-NEXT: [[DOTMUX:%.*]] = select i1 %cmpb, i32 0, i32 2
; CHECK-NEXT: [[OUTVAL:%.*]] = select i1 [[BRMERGE]], i32 [[DOTMUX]], i32 1, !prof !12
; CHECK-NEXT: ret i32 [[OUTVAL]]
;
block1:
br i1 %cmpb, label %block3, label %block2, !prof !0
block2:
br i1 %cmpa, label %block3, label %exit, !prof !2
block3:
%cowval = phi i32 [ 2, %block2 ], [ 0, %block1 ]
br label %exit
exit:
%outval = phi i32 [ %cowval, %block3 ], [ 1, %block2 ]
ret i32 %outval
}
!0 = !{!"branch_weights", i32 3, i32 5}
!1 = !{!"branch_weights", i32 1, i32 1}
@ -440,4 +467,5 @@ return:
;; treat the weight as an unsigned integer.
; CHECK: !10 = !{!"branch_weights", i32 112017436, i32 -735157296}
; CHECK: !11 = !{!"branch_weights", i32 3, i32 5}
; CHECK: !12 = !{!"branch_weights", i32 14, i32 10}