[llvm] [SelectOpt] Add handling for Select-like operations. (PR #77284)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 15 07:20:52 PST 2024
================
@@ -412,6 +412,16 @@ class AArch64TTIImpl : public BasicTTIImplBase<AArch64TTIImpl> {
bool enableSelectOptimize() { return ST->enableSelectOptimize(); }
+ bool shouldTreatInstructionLikeSelect(Instruction *I) {
+ // For the binary operators (e.g. or) we need to be more careful than
+ // selects, here we only transform them if they are already at a natural
+ // break point in the code - the end of a block with an unconditional
+ // terminator.
+ return isa<SelectInst>(I) ||
----------------
david-arm wrote:
Instead of checking for `BinaryOperator` here, do we actually want to explicitly look for `or` instructions instead? I'm just wondering what happens if later on someone extends the SelectLike class in SelectOptimize to cover more binary operators.
I actually wonder if this function should be called directly by SelectLike::match and whether that simplifies the logic a little?
https://github.com/llvm/llvm-project/pull/77284
More information about the llvm-commits
mailing list