[llvm] [RISCV] Early exit if the type legalization cost is not valid for getIntrinsicInstrCost (PR #154256)

Jim Lin via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 20 22:12:16 PDT 2025


================
@@ -1245,29 +1245,30 @@ InstructionCost
 RISCVTTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
                                     TTI::TargetCostKind CostKind) const {
   auto *RetTy = ICA.getReturnType();
+  auto *STy = dyn_cast<StructType>(RetTy);
+  Type *LegalizeTy = STy ? STy->getContainedType(0) : RetTy;
----------------
tclin914 wrote:

The `RetTy` might be `{i8, i1}` when the intrinsic is `llvm.sadd.with.overflow`, so we need to use this code to handle this case properly. 

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


More information about the llvm-commits mailing list