summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/BasicTargetTransformInfo.cpp
diff options
context:
space:
mode:
authorHal Finkel <hfinkel@anl.gov>2014-04-14 05:59:09 +0000
committerHal Finkel <hfinkel@anl.gov>2014-04-14 05:59:09 +0000
commit56bf297e3a460c32ad558800e9b397b7cfceb16e (patch)
tree802a3d2e8f836b9ed1bba86dec81ea21c26347eb /llvm/lib/CodeGen/BasicTargetTransformInfo.cpp
parenteed3466a42bc949be5cffe9431c53176e8615994 (diff)
downloadbcm5719-llvm-56bf297e3a460c32ad558800e9b397b7cfceb16e.tar.gz
bcm5719-llvm-56bf297e3a460c32ad558800e9b397b7cfceb16e.zip
Don't assert in BasicTTI::getMemoryOpCost for non-simple types
BasicTTI::getMemoryOpCost must explicitly check for non-simple types; setting AllowUnknown=true with TLI->getSimpleValueType is not sufficient because, for example, non-power-of-two vector types return non-simple EVTs (not MVT::Other). llvm-svn: 206150
Diffstat (limited to 'llvm/lib/CodeGen/BasicTargetTransformInfo.cpp')
-rw-r--r--llvm/lib/CodeGen/BasicTargetTransformInfo.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/BasicTargetTransformInfo.cpp b/llvm/lib/CodeGen/BasicTargetTransformInfo.cpp
index 26bc6218c27..ecb403a4b6d 100644
--- a/llvm/lib/CodeGen/BasicTargetTransformInfo.cpp
+++ b/llvm/lib/CodeGen/BasicTargetTransformInfo.cpp
@@ -424,12 +424,14 @@ unsigned BasicTTI::getMemoryOpCost(unsigned Opcode, Type *Src,
// This is a vector load that legalizes to a larger type than the vector
// itself. Unless the corresponding extending load or truncating store is
// legal, then this will scalarize.
- TargetLowering::LegalizeAction LA;
- MVT MemVT = getTLI()->getSimpleValueType(Src, true);
- if (Opcode == Instruction::Store)
- LA = getTLI()->getTruncStoreAction(LT.second, MemVT);
- else
- LA = getTLI()->getLoadExtAction(ISD::EXTLOAD, MemVT);
+ TargetLowering::LegalizeAction LA = TargetLowering::Expand;
+ EVT MemVT = getTLI()->getValueType(Src, true);
+ if (MemVT.isSimple() && MemVT != MVT::Other) {
+ if (Opcode == Instruction::Store)
+ LA = getTLI()->getTruncStoreAction(LT.second, MemVT.getSimpleVT());
+ else
+ LA = getTLI()->getLoadExtAction(ISD::EXTLOAD, MemVT.getSimpleVT());
+ }
if (LA != TargetLowering::Legal && LA != TargetLowering::Custom) {
// This is a vector load/store for some illegal type that is scalarized.
OpenPOWER on IntegriCloud