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

David Li via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 25 14:45:36 PDT 2016


davidxl added inline comments.

================
Comment at: lib/Transforms/Scalar/LowerExpectIntrinsic.cpp:39
@@ +38,3 @@
+    "likely-branch-weight", cl::Hidden, cl::init(4294967295),
+    cl::desc("Weight of the branch likely to be taken (default = 4294967295)"));
+static cl::opt<uint32_t> UnlikelyBranchWeight(
----------------
Making LikelyWeight more extreme is fine, but  I don't see using max unsigned int is needed. Some large value such as  2000 or 2048 (1<<11) should be good enough.

================
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)"));
 
----------------
I suggest not using 0 weight which BFI can not handle well.  1 should be better.


http://reviews.llvm.org/D19435





More information about the llvm-commits mailing list