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

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 25 14:05:18 PDT 2016


hfinkel accepted this revision.

================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:4558
@@ +4557,3 @@
+    auto Probability = BranchProbability::getBranchProbability(Max, Sum);
+    if (Probability > TLI->getPredictableBranchThreshold())
+      return true;
----------------
spatel wrote:
> 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!
Ah, sounds good. LGTM then too.


http://reviews.llvm.org/D19488





More information about the llvm-commits mailing list