[PATCH] D80984: [CostModel] Unify getMemoryOpCost

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 5 02:09:23 PDT 2020


RKSimon accepted this revision.
RKSimon added a comment.
This revision is now accepted and ready to land.

LGTM with a few style comments - they were already present, but probably worth handling in the refactoring.



================
Comment at: llvm/include/llvm/Analysis/TargetTransformInfoImpl.h:855
+    case Instruction::Store: {
+      const StoreInst *SI = cast<StoreInst>(U);
+      Type *ValTy = U->getOperand(0)->getType();
----------------
auto *SI = cast<StoreInst>(U);


================
Comment at: llvm/include/llvm/Analysis/TargetTransformInfoImpl.h:862
+    case Instruction::Load: {
+      const LoadInst *LI = cast<LoadInst>(U);
+      return TargetTTI->getMemoryOpCost(Opcode, U->getType(), LI->getAlign(),
----------------
auto *LI = cast<LoadInst>(U);


================
Comment at: llvm/lib/Target/X86/X86TargetTransformInfo.cpp:2966
+  if (CostKind != TTI::TCK_RecipThroughput) {
+    if (I && isa<StoreInst>(I)) {
+      Value *Ptr = I->getOperand(1);
----------------
if (isa_and_nonnull<StoreInst>(I)) {


================
Comment at: llvm/lib/Target/X86/X86TargetTransformInfo.cpp:2970
+      // Check the preceding GEP to identify non-const indices.
+      if (auto GEP = dyn_cast<GetElementPtrInst>(Ptr)) {
+        if (!all_of(GEP->indices(), [](Value *V) { return isa<Constant>(V); }))
----------------
auto *GEP


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80984/new/

https://reviews.llvm.org/D80984





More information about the llvm-commits mailing list