[llvm] r205476 - [PowerPC] Make PPCTTI::getMemoryOpCost call BasicTTI::getMemoryOpCost

Hal Finkel hfinkel at anl.gov
Wed Apr 2 15:43:49 PDT 2014


Author: hfinkel
Date: Wed Apr  2 17:43:49 2014
New Revision: 205476

URL: http://llvm.org/viewvc/llvm-project?rev=205476&view=rev
Log:
[PowerPC] Make PPCTTI::getMemoryOpCost call BasicTTI::getMemoryOpCost

PPCTTI::getMemoryOpCost will now make use of BasicTTI::getMemoryOpCost to
calculate the base cost of the memory access, and then adjust on top of that.
There is no functionality change from this modification, but it will become
important so that PPCTTI can take advantage of scalarization information for which
BasicTTI::getMemoryOpCost will account in the near future.

Modified:
    llvm/trunk/lib/Target/PowerPC/PPCTargetTransformInfo.cpp

Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetTransformInfo.cpp?rev=205476&r1=205475&r2=205476&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCTargetTransformInfo.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCTargetTransformInfo.cpp Wed Apr  2 17:43:49 2014
@@ -241,8 +241,8 @@ unsigned PPCTTI::getMemoryOpCost(unsigne
   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(unsigne
   // 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;
 }





More information about the llvm-commits mailing list