[llvm] r268141 - add minimal test to show dropped metadata
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 29 17:12:54 PDT 2016
Author: spatel
Date: Fri Apr 29 19:12:54 2016
New Revision: 268141
URL: http://llvm.org/viewvc/llvm-project?rev=268141&view=rev
Log:
add minimal test to show dropped metadata
Modified:
llvm/trunk/test/Transforms/SimplifyCFG/preserve-branchweights.ll
Modified: llvm/trunk/test/Transforms/SimplifyCFG/preserve-branchweights.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyCFG/preserve-branchweights.ll?rev=268141&r1=268140&r2=268141&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/SimplifyCFG/preserve-branchweights.ll (original)
+++ llvm/trunk/test/Transforms/SimplifyCFG/preserve-branchweights.ll Fri Apr 29 19:12:54 2016
@@ -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}
More information about the llvm-commits
mailing list