[PATCH] D120231: [SelectOpti][3/5] Base Heuristics

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 20 09:10:38 PDT 2022


davidxl added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectOptimize.cpp:179-181
+  // If even a predictable select is cheap, then a branch cannot be cheaper.
+  if (!TLI->isPredictableSelectExpensive())
+    return false;
----------------
bsmith wrote:
> Is this the correct thing to check for here?
> 
> Even if a select is cheap, the true/false values feeding it may not be, and given the later change you have that can sink these values when converted to a branch, this check may cause us to miss some cases where this pass is still useful. (Although perhaps changing this should be deferred to the patch that does the sinking).
This is a good point.  Perhaps the target specific behavior should be modeled using a cost value (SelectCost) instead of using the binary knob.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120231/new/

https://reviews.llvm.org/D120231



More information about the llvm-commits mailing list