From 772349de887839add823af70b0cdb37f3b47fbc3 Mon Sep 17 00:00:00 2001 From: Sam Parker Date: Mon, 8 Jun 2020 09:11:08 +0100 Subject: [PATCH] [PPC] Try to fix builbots Attempt to handle unsupported types, such as structs, in getMemoryOpCost. The backend now checks for a supported type and calls into BasicTTI as a fallback. BasicTTI will now also perform the same check and will default to an expensive cost of 4 for 'Other' MVTs. Differential Revision: https://reviews.llvm.org/D80984 --- llvm/include/llvm/CodeGen/BasicTTIImpl.h | 3 +++ llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/llvm/include/llvm/CodeGen/BasicTTIImpl.h b/llvm/include/llvm/CodeGen/BasicTTIImpl.h index 3bc9467bef78..8d83306ba3be 100644 --- a/llvm/include/llvm/CodeGen/BasicTTIImpl.h +++ b/llvm/include/llvm/CodeGen/BasicTTIImpl.h @@ -884,6 +884,9 @@ public: TTI::TargetCostKind CostKind, const Instruction *I = nullptr) { assert(!Src->isVoidTy() && "Invalid type"); + // Assume types, such as structs, are expensive. + if (getTLI()->getValueType(DL, Src, true) == MVT::Other) + return 4; std::pair LT = getTLI()->getTypeLegalizationCost(DL, Src); // Assuming that all loads of legal types cost 1. diff --git a/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp b/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp index e3ef71fdae0d..8c77d743562f 100644 --- a/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp +++ b/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp @@ -859,6 +859,9 @@ int PPCTTIImpl::getMemoryOpCost(unsigned Opcode, Type *Src, MaybeAlign Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind, const Instruction *I) { + if (TLI->getValueType(DL, Src, true) == MVT::Other) + return BaseT::getMemoryOpCost(Opcode, Src, Alignment, AddressSpace, + CostKind); // Legalize the type. std::pair LT = TLI->getTypeLegalizationCost(DL, Src); assert((Opcode == Instruction::Load || Opcode == Instruction::Store) && -- GitLab