summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/CodeGen/BasicTargetTransformInfo.cpp14
-rw-r--r--llvm/test/Analysis/CostModel/PowerPC/load_store.ll3
2 files changed, 11 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.
diff --git a/llvm/test/Analysis/CostModel/PowerPC/load_store.ll b/llvm/test/Analysis/CostModel/PowerPC/load_store.ll
index 40862780faf..368f0a73489 100644
--- a/llvm/test/Analysis/CostModel/PowerPC/load_store.ll
+++ b/llvm/test/Analysis/CostModel/PowerPC/load_store.ll
@@ -37,6 +37,9 @@ define i32 @loads(i32 %arg) {
; CHECK: cost of 1 {{.*}} load
load <4 x i32>* undef, align 4
+ ; CHECK: cost of 46 {{.*}} load
+ load <3 x float>* undef, align 1
+
ret i32 undef
}
OpenPOWER on IntegriCloud