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

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 20 10:15:15 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;
----------------
artagnon wrote:

Why is this necessary? Is it correct to get the 0th contained type?

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


More information about the llvm-commits mailing list