[llvm] [RISCV][CostModel] Remove inst cost of cmp inst in cmp-select sequence. (PR #91158)

Elvis Wang via llvm-commits llvm-commits at lists.llvm.org
Mon May 6 03:16:48 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 &&
----------------
ElvisWang123 wrote:

Fixed. Thanks!

https://github.com/llvm/llvm-project/pull/91158


More information about the llvm-commits mailing list