[llvm] [SimplifyCFG] Increase budget for FoldTwoEntryPHINode() if the branch is unpredictable. (PR #98495)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 18 08:34:04 PDT 2024


================
@@ -419,6 +419,11 @@ class TargetTransformInfo {
   /// this factor, it is very likely to be predicted correctly.
   BranchProbability getPredictableBranchThreshold() const;
 
+  // Returns an integer indicating how aggressive the target wants for
+  // eliminating unpredictable branches. A zero return value means extra
+  // optimization applied to them should be minimal.
+  unsigned getBranchMispredictPenalty() const;
----------------
RKSimon wrote:

Can we be more specific about how this penalty (and the threshold) is used - should it be comparable to TCK_Latency costs (and should it return InstructrionCost?).

https://github.com/llvm/llvm-project/pull/98495


More information about the llvm-commits mailing list