[PATCH] D19488: [CodeGenPrepare] use branch weight metadata to decide if a select should be turned into a branch

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 25 13:51:52 PDT 2016


spatel added inline comments.

================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:4558
@@ +4557,3 @@
+    auto Probability = BranchProbability::getBranchProbability(Max, Sum);
+    if (Probability > TLI->getPredictableBranchThreshold())
+      return true;
----------------
hfinkel wrote:
> Does this handle both extremes (i.e. almost always true and almost always false)?
Yes - since we're using the max value of true or false, it will work. 

It was just laziness for me to not include that test case. Let me add it and update the patch. Thanks!


http://reviews.llvm.org/D19488





More information about the llvm-commits mailing list