[llvm] [SelectOpt] Add handling for Select-like operations. (PR #77284)
David Green via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 16 07:19:55 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) ||
+ (isa<BinaryOperator>(I) && isa<BranchInst>(I->getNextNode()) &&
+ cast<BranchInst>(I->getNextNode())->isUnconditional());
----------------
davemgreen wrote:
Yeah we only want to add them where there was already a natural break point in the code, not introduce a new one.
https://github.com/llvm/llvm-project/pull/77284
More information about the llvm-commits
mailing list