[llvm] [RISCV][CostModel] Remove inst cost of cmp inst in cmp-select sequence. (PR #91158)
Shih-Po Hung via llvm-commits
llvm-commits at lists.llvm.org
Sun May 5 18:55:09 PDT 2024
================
@@ -1436,6 +1436,13 @@ InstructionCost RISCVTTIImpl::getCmpSelInstrCost(unsigned Opcode, Type *ValTy,
}
}
+ // The cmp + select instructions will lower to SELECT_CC and lower to
+ // PseudoCCMOVGPR which will generate a conditional branch + mv. The
+ // cost of (cmp + select) will be (0 + select inst cost).
+ if (I && I->hasOneUser() && isa<SelectInst>(I->user_back()) &&
+ I->user_back()->getOperand(0) == I)
+ return 0;
----------------
arcbbb wrote:
We need to verify whether `I` is an ICmp instruction.
https://github.com/llvm/llvm-project/pull/91158
More information about the llvm-commits
mailing list