[PATCH] D19674: [SimplifyCFG] propagate branch metadata when creating select

David Li via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 29 21:01:29 PDT 2016


davidxl added inline comments.

================
Comment at: test/Transforms/SimplifyCFG/preserve-branchweights.ll:422
@@ -421,3 +421,3 @@
 ; CHECK-NEXT:    [[BRMERGE:%.*]] = or i1 %cmpb, %cmpa
-; CHECK-NEXT:    [[DOTMUX:%.*]] = select i1 %cmpb, i32 0, i32 2
+; CHECK-NEXT:    [[DOTMUX:%.*]] = select i1 %cmpb, i32 0, i32 2, !prof !11
 ; CHECK-NEXT:    [[OUTVAL:%.*]] = select i1 [[BRMERGE]], i32 [[DOTMUX]], i32 1, !prof !12
----------------
spatel wrote:
> davidxl wrote:
> > If I read the code correctly, should the weights for select be 9:5 ? !11 does not look correct.
> I thought the weights for the select would be equal to the weights of the original branch because they have the same comparison condition (%cmpb), 3:5. How do you calculate 9:5?
Should it be 3 : 5 * (1/3)  which 9 : 5?  When block 2 is entered, there is only 1/3 probability it reaches block3.


http://reviews.llvm.org/D19674





More information about the llvm-commits mailing list