[PATCH] D19435: [LowerExpectIntrinsic] pin default likely/unlikely weights to min/max values

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 26 09:11:37 PDT 2016


spatel added inline comments.

================
Comment at: lib/Transforms/Scalar/LowerExpectIntrinsic.cpp:42
@@ -43,1 +41,3 @@
+    "unlikely-branch-weight", cl::Hidden, cl::init(0),
+    cl::desc("Weight of the branch unlikely to be taken (default = 0)"));
 
----------------
davidxl wrote:
> I suggest not using 0 weight which BFI can not handle well.  1 should be better.
I thought this over, and I really don't want to compromise on either value here. The meaning of builtin_expect() is clear, and we should honor that programmer directive. Picking semi-random values from the air can only lead to unseen problems down the road.

Can you explain why/where BFI has a problem with a '0' weight? If it's a simple bug, I will try to fix that before this patch.


http://reviews.llvm.org/D19435





More information about the llvm-commits mailing list