[llvm] [RISCV][CostModel] Remove inst cost of cmp inst in cmp-select sequence. (PR #91158)
Kito Cheng via llvm-commits
llvm-commits at lists.llvm.org
Mon May 6 02:08:25 PDT 2024
================
@@ -1443,6 +1443,17 @@ InstructionCost RISCVTTIImpl::getCmpSelInstrCost(unsigned Opcode, Type *ValTy,
}
}
+ // With ShortForwardBranchOpt or ConditionalMoveFusion, scalar icmp + select
+ // instructions will lower to SELECT_CC and lower to PseudoCCMOVGPR which will
+ // generate a conditional branch + mv. The cost of scalar (icmp + select) will
+ // be (0 + select instr cost).
+ if ((ST->hasShortForwardBranchOpt() || ST->hasConditionalMoveFusion()) && I &&
----------------
kito-cheng wrote:
```suggestion
if (ST->hasConditionalMoveFusion() && I &&
```
`hasConditionalMoveFusion` already checked `hasShortForwardBranchOpt`.
[1] https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/RISCV/RISCVSubtarget.h#L161-L165
https://github.com/llvm/llvm-project/pull/91158
More information about the llvm-commits
mailing list