[PATCH] D36896: [TargetTransformInfo] Call target getMemoryOpCost for LoadInst from getUserCost
Guozhi Wei via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 18 14:05:28 PDT 2017
Carrot created this revision.
In modern processors, memory load is much slower than basic ALU instructions.
In function TargetTransformInfoImplCRTPBase::getUserCost, TargetTransformInfoImplBase::getOperationCost is called to compute the cost of memory load, and TTI::TCC_Basic is returned, it's different from real world cost.
This patch changes it to call target dependent getMemoryOpCost implementation to compute the cost of memory load.
https://reviews.llvm.org/D36896
Files:
include/llvm/Analysis/TargetTransformInfoImpl.h
Index: include/llvm/Analysis/TargetTransformInfoImpl.h
===================================================================
--- include/llvm/Analysis/TargetTransformInfoImpl.h
+++ include/llvm/Analysis/TargetTransformInfoImpl.h
@@ -736,6 +736,13 @@
return static_cast<T *>(this)->getExtCost(CI, Operands.back());
}
+ if (const LoadInst *LI = dyn_cast<LoadInst>(U)) {
+ return static_cast<T *>(this)->getMemoryOpCost(LI->getOpcode(),
+ LI->getType(),
+ LI->getAlignment(),
+ LI->getPointerAddressSpace(), LI);
+ }
+
return static_cast<T *>(this)->getOperationCost(
Operator::getOpcode(U), U->getType(),
U->getNumOperands() == 1 ? U->getOperand(0)->getType() : nullptr);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36896.111737.patch
Type: text/x-patch
Size: 832 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170818/4c894042/attachment.bin>
More information about the llvm-commits
mailing list