[PATCH] D35888: Changed basic cost of Store operation on X86.

Evgeny Astigeevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 27 05:34:28 PDT 2017


eastig added a comment.

In https://reviews.llvm.org/D35888#822634, @delena wrote:

> > Maybe I am wrong but the instruction cost is the cost relative to the cost of a typical instruction. TTI does not operates in terms of microarchitecture: u-ops etc. Why do we need a general function which is only for X86? How will other architectures need it? If everyone is happy with getOperationCost why X86 is not? Is it possible to have this functionality in X86TTI without changing general TTI?
>
> The second option is to customize the getOperationCost() for X86.  Agree, it is also a way to provide target specific cost. Is that what you suggest?


Yes, some kind of this. getOperationCost or getUserCost can be customized. For example, X86TTIImpl can override getUserCost in the following way:

  unsigned X86TIImpl::getUserCost(const User *U,                                 
                                   ArrayRef<const Value *> Operands) {            
    if (isa<StoreInst>(U))
        return getStoreCost(cast<Instruction>(U));
    return BaseT::getUserCost(U, Operands);                                       
  }                                              


Repository:
  rL LLVM

https://reviews.llvm.org/D35888





More information about the llvm-commits mailing list