[llvm] 27b6ddb - [RISCV] Speculative fix for issue reported against D147470 post commit

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 5 17:25:54 PDT 2023


Author: Philip Reames
Date: 2023-04-05T17:25:42-07:00
New Revision: 27b6ddbf6ea632389f582c0ca1481ed370f0af45

URL: https://github.com/llvm/llvm-project/commit/27b6ddbf6ea632389f582c0ca1481ed370f0af45
DIFF: https://github.com/llvm/llvm-project/commit/27b6ddbf6ea632389f582c0ca1481ed370f0af45.diff

LOG: [RISCV] Speculative fix for issue reported against D147470 post commit

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
index 1890d3b994b75..39824773fea10 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);


        


More information about the llvm-commits mailing list