[PowerPC] Make PPCTTI::getMemoryOpCost call BasicTTI::getMemoryOpCost
[oota-llvm.git] / lib / Target / PowerPC / PPCTargetTransformInfo.cpp
index a915b04fa500838542d7bd0c730cdc2faac2fd49..2f4d5c1dec3115a38c8d0309128ecad9f0961133 100644 (file)
@@ -241,8 +241,8 @@ unsigned PPCTTI::getMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment,
   assert((Opcode == Instruction::Load || Opcode == Instruction::Store) &&
          "Invalid Opcode");
 
-  // Each load/store unit costs 1.
-  unsigned Cost = LT.first * 1;
+  unsigned Cost =
+    TargetTransformInfo::getMemoryOpCost(Opcode, Src, Alignment, AddressSpace);
 
   // FIXME: Update this for VSX loads/stores that support unaligned access.
 
@@ -250,7 +250,7 @@ unsigned PPCTTI::getMemoryOpCost(unsigned Opcode, Type *Src, unsigned Alignment,
   // to be decomposed based on the alignment factor.
   unsigned SrcBytes = LT.second.getStoreSize();
   if (SrcBytes && Alignment && Alignment < SrcBytes)
-    Cost *= (SrcBytes/Alignment);
+    Cost += LT.first*(SrcBytes/Alignment-1);
 
   return Cost;
 }