From 27b6ddbf6ea632389f582c0ca1481ed370f0af45 Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Wed, 5 Apr 2023 17:25:12 -0700 Subject: [PATCH] [RISCV] Speculative fix for issue reported against D147470 post commit --- llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp index 1890d3b..3982477 100644 --- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp +++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp @@ -1277,6 +1277,12 @@ InstructionCost RISCVTTIImpl::getMemoryOpCost(unsigned Opcode, Type *Src, TTI::TargetCostKind CostKind, TTI::OperandValueInfo OpInfo, const Instruction *I) { + EVT VT = TLI->getValueType(DL, Src, true); + // Type legalization can't handle structs + if (VT == MVT::Other) + return BaseT::getMemoryOpCost(Opcode, Src, Alignment, AddressSpace, + CostKind, OpInfo, I); + InstructionCost Cost = 0; if (Opcode == Instruction::Store && OpInfo.isConstant()) Cost += getStoreImmCost(Src, OpInfo, CostKind); -- 2.7.4