[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:33:19 PDT 2016
hfinkel added inline comments.
================
Comment at: include/llvm/Target/TargetLowering.h:268
@@ +267,3 @@
+ virtual BranchProbability getPredictableBranchThreshold() const {
+ return BranchProbability(99, 100);
+ }
----------------
Agreed. A command-line option to override the default would be significantly more convenient.
================
Comment at: lib/CodeGen/CodeGenPrepare.cpp:4558
@@ +4557,3 @@
+ auto Probability = BranchProbability::getBranchProbability(Max, Sum);
+ if (Probability > TLI->getPredictableBranchThreshold())
+ return true;
----------------
davidxl wrote:
> Hal, this is an example that profile meta data is directly looked at instead of via BPI (I don't have an issue with it -- but just a note this scenario exists).
I was thinking that :-) -- but this use did not seem to fit into BPI's interface. If/when we start preserving BPI, we'd need to update here, however.
http://reviews.llvm.org/D19488
More information about the llvm-commits
mailing list