[llvm] [RISCV] Account for ADDI immediate range in select of two constants w/ zicond (PR #155471)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 26 12:18:55 PDT 2025


================
@@ -9280,11 +9280,21 @@ SDValue RISCVTargetLowering::lowerSELECT(SDValue Op, SelectionDAG &DAG) const {
         }
       }
 
-      const int TrueValCost = RISCVMatInt::getIntMatCost(
-          TrueVal, Subtarget.getXLen(), Subtarget, /*CompressionCost=*/true);
-      const int FalseValCost = RISCVMatInt::getIntMatCost(
-          FalseVal, Subtarget.getXLen(), Subtarget, /*CompressionCost=*/true);
-      bool IsCZERO_NEZ = TrueValCost <= FalseValCost;
+      auto getCost = [&](APInt Delta, APInt Addend) {
----------------
topperc wrote:

const APInt &

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


More information about the llvm-commits mailing list